RE: [PHP] thumbnail???

From: Date: Wed, 21 Jan 2004 13:42:43 +0000
Subject: RE: [PHP] thumbnail???
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-175289@lists.php.net to get a copy of this message
Try this: function Resize_Image($FilePath, $new_w){ $File = fopen($FilePath, "r"); $FileContents = fread($File, filesize($FilePath)); $src = imagecreatefromstring($FileContents); $width = imagesx($src); // Shrink the image to the maximum width // Maintaining aspect ratio if($width > $new_w){ $height = imagesy($src); $aspect_ratio = $height/$width; $new_h = abs($new_w * $aspect_ratio); $img = imagecreatetruecolor($new_w,$new_h); imagecopyresized($img,$src,0,0,0,0,$new_w,$new_h,$width,$height); ob_start(); imagejpeg($img); $FileContents = ob_get_contents(); ob_end_clean(); imagedestroy($img); } return $FileContents; } you can then either save the filecontents as an image, or place it in a database. -----Original Message----- From: Rafael Alex Cremer [mailto:rcremer@inf.furb.br] Sent: Tuesday, January 20, 2004 5:29 PM To: php-general@lists.php.net Subject: [PHP] thumbnail??? OK, but how? I already use GD, I need to now how to create a thumbnail, somebody now how to use the GD functions to create a thumbnail??? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#175289) next »