Ok i've read up on a few other posts and they are kinda like what im looking for but not quite.

What would be the best funcion to use if I want to basically do this:


$thumbX = 120;
$thumbY= 90;
$imgSrc=photo.jpg;

make a image via copying photo.jpg with the width of 120 and height 90 and saving it as photo_thumb.jpg.

The image needs to be decent quality IE no major color or pixel loss.

Thanks,

Jesse Edwards

    The best way to do this is to use djpeg and cjpeg that comes installed on most Linux installs. There really isn't anything that I know of in Windows. These tools do a great job of resizing images for you. You would just use a system() command like the following:

    djpeg $userfile | pnmscale -width 150 | cjpeg > /path/to/saved/file/$userfile

      I tried using what you said and it made a copy of the image but it was 0 bytes in size. Something didnt go right. Ill keep fooling with it.

        If you are looking to do this within a PHP script, then the easiest method would be to use imageCopyResampled() (see http://php.net/imagecopyresampled for details). You will need to have the GD library installed to do this.

        • Nick
          Write a Reply...