note 45745 added to function.imagejpeg

From: Date: Thu, 16 Sep 2004 21:33:17 +0000
Subject: note 45745 added to function.imagejpeg
Groups: php.notes 
Request: Send a blank email to php-notes+get-76848@lists.php.net to get a copy of this message
This code will let you open any image, edit it, and output it directly to the clients browser: header("Content-type: image/jpeg"); //Adds the mime header $image = imagecreatefromstring(file_get_contents($path)); //Reads an image with any mime type //Here you can do anything you want with the $image //Such as resizing, filtering, or writing on it imagejpeg($image, "", 100); //Outputs the image directly to the browser in jpeg format with no loss of quality imagedestroy($image); //clears the memory space allocated for that image The only problem with this code is that if you open an animated gif image, it will only output the first frame of it, because the image is converted to a jpeg in the process. ---- Manual Page -- http://www.php.net/manual/en/function.imagejpeg.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+45745 Delete -- http://master.php.net/manage/user-notes.php?action=delete+45745&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+45745&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#76848) next »