note 15022 deleted from function.imagecopyresampled by aidan

From: Date: Mon, 04 Oct 2004 09:46:13 +0000
Subject: note 15022 deleted from function.imagecopyresampled by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-77974@lists.php.net to get a copy of this message
Note Submitter: johnp at positivespinmedia dot com ---- Here is the code I used to resize a given image: $src_img = imagecreatefromjpeg("/path/to/$my_src_file"); $dst_img = imagecreatetruecolor($dest_width,$dest_height); imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $dest_width, $dest_height, $src_width, $src_height); imagejpeg($dst_img, "/path/to/storage/new_file.jpg", $quality); imagedestroy($src_img); imagedestroy($dst_img); As mentioned previously, it is very important to use 'imagecreatetruecolor' to allocate memory for your new image... it will not be the correct color otherwise.

« previous php.notes (#77974) next »