Using GD library to physically resize JPEGs<

Hi,

For two reasons:

(1) It loads quicker
(2) It takes up less space on my web server

I want to physically resize JPEG photos to the size I want when they have been uploaded to my server via my upload code, then re-save them in these resized forms.

I have been informed I can use the PHP GD library to do this, but I am a novice at GD, and all the tutorials I have found online focus on creating charts/pie charts or generating images, which is not actually what I want.

Can anyone tell me briefly how I would resize an $x by $y photo to dimensions $p by $q using GD functions?

Many thanks

MarkImage Functions (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/ref.image.php">http://www.php.net/manual/en/ref.image.php</a><!-- m -->) will tell you what you can use. look into imagecreatefromjpeg (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/function.imagecreatefromjpeg.php">http://www.php.net/manual/en/function.i ... omjpeg.php</a><!-- m -->)is there any way to do the same thing in ASP too? i have been trying to figure this out myself! :) (?)But it seems that you want to actually make the file size smaller, that can't be done can it?

Anthony, I think it's called FileSystemObject. You'll get more info by making a thread in the server side forum(not php).yes josh, you can make it any size you want. only with the correct functions though.You mean you could actually change the file size? Interesting...do you know what functions are needed to do this?Originally posted by scoutt
Image Functions (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/ref.image.php">http://www.php.net/manual/en/ref.image.php</a><!-- m -->) will tell you what you can use. look into imagecreatefromjpeg (<!-- m --><a class="postlink" href="http://www.php.net/manual/en/function.imagecreatefromjpeg.php">http://www.php.net/manual/en/function.i ... omjpeg.php</a><!-- m -->)
ahem :DHeh, well I knew about that function, I just didn't know it had the capability of remaking the image in a smaller file size.with that function you can make it any size. henc ethe name of the function.

image create from jpeg
 
Back
Top