note 45745 deleted from function.imagejpeg by tomsommer

From: Date: Thu, 16 Sep 2004 22:15:07 +0000
Subject: note 45745 deleted from function.imagejpeg by tomsommer
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-76852@lists.php.net to get a copy of this message
Note Submitter: echo at zerocide dot net ---- 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.

« previous php.notes (#76852) next »