MySQL Forums
Forum List  »  PHP

Re: Store GIF in Blob and show GIF on page
Posted by: Breck Fresen
Date: December 09, 2006 01:58AM

The problem centers around setting the content type. I handle it as follows:

<img src="GetImage.php">

Below are the contents of GetImage.php
<?php
/* Your code to connect to the database, to retrieve the blob
and the content-type for that blob goes here. */

header("Content-Type: " . $row['ContentType']);
header("Content-Length: " . $row['FileSize']);

echo $row['Content'];
?>

Be careful of white space here. The browser will try to render the entire output from this file as the image, so if you have extra white space at the beginning or end of the file, the image won't display properly (you'll get a lot of confusing looking text).

Options: ReplyQuote


Subject
Written By
Posted
Re: Store GIF in Blob and show GIF on page
December 09, 2006 01:58AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.