imagecopyresample

From: Date: Thu, 14 Apr 2005 13:04:25 +0000
Subject: imagecopyresample
Groups: php.general 
Request: Send a blank email to php-general+get-213073@lists.php.net to get a copy of this message
I have created (adapted) the follow function: function imageresize($new_width, $new_height, $filename) { // Content type header('Content-type: image/jpeg'); // Get new dimensions list($width, $height) = getimagesize($filename); // Resample $image_p = imagecreatetruecolor($new_width, $new_height); $image = imagecreatefromjpeg($filename); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // Output imagejpeg($image_p, null, 100); } The idea is it takes a image and resizes it at server end so that you dont have to download a massive image. And it works. That is as long as that function is the only think you doing. For example if I have a page with the following in it: <?php require_once('../includes/functions.php'); imageresize('100', '75', 'pages/1.jpg'); ?> I get my image resized. (functions.php is where all my fuctions are stored) However if I place anything after the imageresize it doesnt show that. Eg echo"hello'; does nothing. If anything goes before it the whole page doesnt work. Any ideas why this is happening and how I can work around it? --------------------------------------------------------------------------------------------- check out my blog to find out what im up to: http://www.zaphodmcmillan.com/

« previous php.general (#213073) next »