note 71945 rejected from function.imagejpeg by bjori

From: Date: Mon, 25 Dec 2006 19:56:19 +0000
Subject: note 71945 rejected from function.imagejpeg by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-120906@lists.php.net to get a copy of this message
Note Submitter: tommy2d at gmail dot com ---- I'm having major trouble using this function to create an image that can be loaded with Flash. I tried it with several different scripts and the authors of those scripts don't have a clue why it doesn't work. This is my test script: <?php header ("Content-Type: image/jpeg"); $image = imagecreatefromjpeg("foto2.jpg"); ob_start(); // start a new output buffer imagejpeg($image, null, 80); $ImageData = ob_get_contents(); $ImageDataLength = ob_get_length(); ob_end_clean(); // stop this output buffer header("Content-Length: ".$ImageDataLength); echo $ImageData; ?> According to http://www.rexswain.com/httpview.html the headers are the following: HTTP/1.1·200·OK(CR)(LF) Date:·Mon,·25·Dec·2006·11:57:33·GMT(CR)(LF) Server:·Apache/2.0.54·(Linux/SUSE)(CR)(LF) X-Powered-By:·PHP/5.1.4(CR)(LF) Content-Length:·5966(CR)(LF) Connection:·close(CR)(LF) Content-Type:·image/jpeg(CR)(LF) (CR)(LF) When I save the image that's been exported by this script as a regular file, flash IS able to load it. When i feed this script (or any other script) a normal JPEG file it does work. The headers in this case are: HTTP/1.1·200·OK(CR)(LF) Date:·Mon,·25·Dec·2006·11:59:02·GMT(CR)(LF) Server:·Apache/2.0.54·(Linux/SUSE)(CR)(LF) Last-Modified:·Thu,·06·Jul·2006·22:26:59·GMT(CR)(LF) ETag:·"1b2fd-8c8d-417f13f09b2c0"(CR)(LF) Accept-Ranges:·bytes(CR)(LF) Content-Length:·35981(CR)(LF) Connection:·close(CR)(LF) Content-Type:·image/jpeg(CR)(LF) Is this problem in any way associated with this function? Or what could i be doing wrong?

« previous php.notes (#120906) next »