note 43288 added to function.imagecopyresampled

From: Date: Wed, 16 Jun 2004 20:08:23 +0000
Subject: note 43288 added to function.imagecopyresampled
Groups: php.notes 
Request: Send a blank email to php-notes+get-71162@lists.php.net to get a copy of this message
here is my clear method to resize images you can check how it works on http://www.jetevents.pl/index.php <?php $maxx=100; // maximum width $maxy=75; // maximum height $name=strtolower(substr($_FILES['file']['name'],0,-4)).".jpg"; // name of file - must be jpg $size = GetImageSize ($_FILES['file']['tmp_name']); // params of image if ($size[0]>$size[1]) {$sizemin[0]=$maxx;$sizemin[1]=$maxy;}; if ($size[1]>$size[0]) {$sizemin[0]=$maxy;$sizemin[1]=$maxx;}; $im=@imagecreatefromjpeg($path); // path to your gallery $small = imagecreatetruecolor($sizemin[0], $sizemin[1]); // new image ImageCopyResampled($small, $im, 0, 0, 0, 0, $sizemin[0], $sizemin[1], $size[0], $size[1]); // below is main function resampling image ImageDestroy($im); // free memory if (ImageJPEG($small,$path,100)) // try to save image { echo "File $path has been written<br>\n"; // success echo "size: ".$sizemin[0]."x".$sizemin[1] ."<br>\n"; } else { echo "<font color=red><b>"; // failed to write file echo "Error ! File has not been written."; echo "</b></font><br>\n"; }; ?> ---- Manual Page -- http://www.php.net/manual/en/function.imagecopyresampled.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+43288 Delete -- http://master.php.net/manage/user-notes.php?action=delete+43288&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+43288&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#71162) next »