note 21066 deleted from function.imagecopyresized by alindeman

From: Date: Sat, 27 Apr 2002 18:21:21 +0000
Subject: note 21066 deleted from function.imagecopyresized by alindeman
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-29928@lists.php.net to get a copy of this message
Is it possible to use ImageCopyResized to resize an image without stretching? I want to create thumbnails of a maximum size of 120x100. But when I use the code below, some images look really bad because the original dimensions weren't the same proportion. So I would like to create the largest proportional thumbnail I can within the 120x100 limit. Any pointers on how to do this? Here's the code I'm using now: $im = ImageCreateFromJPEG( $scrFile ); $srcW = ImageSX( $im ); $srcH = ImageSY( $im ); $ni = ImageCreate( $dstW, $dstH ); ImageCopyResize( $ni, $im, 0, 0, 0, 0, $dstW, $dstH, $srcW, $srcH ); ImageJPEG( $ni, $dstFile );

« previous php.notes (#29928) next »