Re: Loading Images from PHP broken on Redhat Enterprise
| From: | Kevin Smith | Date: | Thu, 17 Nov 2005 00:33:49 +0000 |
| Subject: | Re: Loading Images from PHP broken on Redhat Enterprise | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-225949@lists.php.net to get a copy of this message | ||
Hi Curt,
In that case, what on earth is going on. This is the script which is on both servers: However, I noticed that if I moved the following lines to the top of the script:
header("Content-Type: image/jpeg");
header("Content-Transfer-Encoding: binary");
..and hard-code the mime type, it outputs the correct headers, apart from "Transfer-Encoding:chunked". Which seems to still screw it up. The content length is wrong (13198), it should be 13184. Looking at the RAW output of the image data, there is a difference. I noticed 3381 was output as part of the image data, yet this is not so on the Server #1, that works. Even if I fix the content-length header to what it should be, it still has some differences.
It still bugs me that the data is absolutely fine in the database, as I can save the data out of it into a file and view that file as an image with no problems at all.
Anything else you can think of?
Thanks,
Kevin
<?php
require('../classes/housekeeping.php');
$db_conn = new HOUSEKEEPING;
$limiteds = $db_conn->database();
require('../classes/categories.php');
if ( isset($_GET['image_id']) && isset($_GET['field_id']) && isset($_GET['mime_type']) )
{
$image_info = new CATEGORY;
$image_info->LINK = $limiteds;
$image_info->IMAGE_ID = $_GET['image_id'];
$image_info->FIELD_ID = $_GET['field_id'];
$image_info->get_thumb_image();
header("Content-Type: ".$_GET['mime_type']);
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".strlen($image_info->IMAGE_THUMB));
echo $image_info->IMAGE_THUMB;
}
elseif ( isset($_GET['image_id']) && isset($_GET['field_id']) )
{
$image_info = new CATEGORY;
$image_info->LINK = $limiteds;
$image_info->IMAGE_ID = $_GET['image_id'];
$image_info->FIELD_ID = $_GET['field_id'];
$image_info->get_thumb_image();
header("Content-Type: $image_info->MIME_TYPE");
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".strlen($image_info->IMAGE_THUMB));
echo $image_info->IMAGE_THUMB;
}
?>
Curt Zirzow wrote:
On Wed, Nov 16, 2005 at 11:44:27PM +0000, Kevin Smith wrote:HI Robert, Server #1 (working) http://www.limiteds.com/includes/image_load.php?image_id=8522&field_id=image_full_2Headers for this one: Content-Transfer-Encoding: binary Vary: Accept-Encoding,User-Agent Content-Encoding: gzip P3P: CP="NOI DSP COR NID CUR OUR NOR" Content-Length: 12547 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Content-Type: image/jpegServer #2 (sad and not working) http://www.limitedshop.co.uk/includes/image_load.php?image_id=8522&field_id=image_full_2And This one: P3P: CP="NOI DSP COR NID CUR OUR NOR" Keep-Alive: timeout=15, max=100 Connection: Keep-Alive Transfer-Encoding: chunked Content-Type: text/html; charset=ISO-8859-1 Something is different. Curt.
Attachment: [application/x-pkcs7-signature] S/MIME Cryptographic Signature smime.p7s