Web Hosting Talk







View Full Version : Resizing jpg


runat
03-04-2002, 05:36 PM
Hello,

I want to resize a large jpg to a max width and height of 250 ?

Who can help me ? I can't get it working

Greetings Tom

dnid
03-04-2002, 07:06 PM
every graphic-software should do the job in under 2 seconds

HTH
Daniel

BTW: This is a Cobalt RaQ forum.

NoComment
03-04-2002, 11:55 PM
if you have ImageMagick on the server do this


convert -size 250x250 existingimage.jpg newimagename.jpg

Every graphic editor can do this also.. but you can't always script something like this with every graphic editor :)

What if your have 250 images you have to do this on?

*NoComment*


PS: I don't think this post belongs here though.

sjau
03-05-2002, 03:08 AM
You can do it with GDLibary. I have here some code of you that does the resizing:


$src = ImageCreateFromJPEG("$picture");
$org_h = imagesy($src );
$org_w = imagesx($src );

if($org_h > $org_w ) {
$cfg[height] = 250;
$cfg[width] = floor($cfg[height] * $org_w / $org_h );
} else {
$cfg[width] = 250;
$cfg[height] = floor($cfg[width] * $org_h / $org_w );