For Programmers: Free Programming Magazines  


Home > Archive > PHP SQL > April 2004 > rezize jpg









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author rezize jpg
Dino Sottini

2004-04-07, 12:44 pm

Dear friends,

I have to resize a jpg image (600x450px) in order to get a new small image
100x75 px , so I used the php functions imagecopyresized() or
imagecopyresampled().
The small photo I created has a low resolution (only 2500bytes), but I need
a photo with an higher resolution (like 4000 bytes, for example).
How can I do this?

Thank you, dear friends, good job

Dino


James Englert

2004-04-10, 9:33 pm

Dino Sottini wrote:

>
> How can I do this?

Here is some code from a project I was doing. I cut out non-essential parts
so it won't work c/p'd. It creates a smaller thumbnail. In the imagejpeg
command, the last number is the quality. You can specify the quality there.
Hope this helps in some way. Good luck!

$img = imagecreatefromjpeg($src);
$tmp = imagecreate($smallwidth, $smallheight);
imagecopyresized($tmp, $img, 0, 0, 0, 0, $smallwidth, $smallheight, $width,
$height);
imagedestroy($img);
$img = $tmp;
imagejpeg($img, $final, 100);
imagedestroy($img);
--
jimE
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com