note 71945 added to function.imagejpeg
| From: | tommy2d at gmail dot com | Date: | Mon, 25 Dec 2006 11:36:41 +0000 |
| Subject: | note 71945 added to function.imagejpeg | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-120895@lists.php.net to get a copy of this message | ||
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?
----
Server IP: 83.137.20.120
Probable Submitter: 84.29.30.229
----
Manual Page -- http://www.php.net/manual/en/function.imagejpeg.php
Edit -- https://master.php.net/note/edit/71945
Del: integrated -- https://master.php.net/note/delete/71945/integrated
Del: useless -- https://master.php.net/note/delete/71945/useless
Del: bad code -- https://master.php.net/note/delete/71945/bad+code
Del: spam -- https://master.php.net/note/delete/71945/spam
Del: non-english -- https://master.php.net/note/delete/71945/non-english
Del: in docs -- https://master.php.net/note/delete/71945/in+docs
Del: other reasons-- https://master.php.net/note/delete/71945
Reject -- https://master.php.net/note/reject/71945
Search -- https://master.php.net/manage/user-notes.php