note 41795 deleted from function.imagecopyresampled by aidan

From: Date: Mon, 04 Oct 2004 09:42:52 +0000
Subject: note 41795 deleted from function.imagecopyresampled by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-77942@lists.php.net to get a copy of this message
Note Submitter: Synn at anachronique dot com ---- A simple way to create a thumbnail from jpeg. Just copy the code below and save it with the name "thumbnail.php" . Link it on another page with the img tag: <img src="thumbnail.php?filename=place_here_imagepath" alt="what you want"/> Change thumbnailWidth if you need. <?php define(thumbnailWidth, "100"); header("Content-type: image/jpeg"); $filename = $HTTP_GET_VARS["filename"]; $source = imagecreatefromjpeg($filename); $thumbX = thumbnailWidth; $imageX = imagesx($source); $imageY = imagesy($source); $thumbY = (int)(($thumbX*$imageY) / $imageX ); $dest = imagecreatetruecolor($thumbX, $thumbY); imagecopyresampled ($dest, $source, 0, 0, 0, 0, $thumbX, $thumbY, $imageX, $imageY); imagejpeg($dest); imagedestroy($dest); imagedestroy($source); ?> Synn (sorry for my bad english:)

« previous php.notes (#77942) next »