I am storing thumbnail images in the DB as BLOB data (I hate myself a little already...) and have a site with a staging site living alongside a production site. In the production site, the thumbnails display just fine. In the sandbox, they do not. The files that display them are the same. The databases are now the same (I have both instances pulling data from the same source DB to remove that variable). It is driving me nuts as to why one works, and the other does not. Further, when I was trying to make all the code from the Sandbox live at the production URL, the thumbnails stayed broken.
These two URLs should look the same: http://sandbox.armoryrevival.com/staging/browse/apartments and http://www.armoryrevival.com/browse/apartments
Even more, the source of the images should look the same: http://sandbox.armoryrevival.com/staging/property/lst_thumbnail/315 and http://www.armoryrevival.com/property/lst_thumbnail/315
To review, the image tags call another PHP file whose job it is to display the BLOB data and set the header of the file. Here is that code, which is identical on both sites:
<?php
$listing_id = requestIdParam();
$query = "SELECT thumbnail FROM listing WHERE id = $listing_id";
$result = mysql_query($query, MyActiveRecord::Connection());
$data = @mysql_fetch_array($result);
if ( !empty($data["thumbnail"]) ) {
// Output the MIME header
header("Content-Type: image/jpeg");
// Output the image
echo $data["thumbnail"];
}
?>
There is no new line before the open PHP tag, which I know is a problem when we are setting headers. What else should I look into? I'm pretty stumped by all this and have run out of paths to trouble shoot. The server error logs don't have anything useful to say. Magic Quotes is Off in the config. PHP config can be checked at http://www.armoryrevival.com/gdinfo.php. Any help is appreciated.