View Single Post
Old 08-27-2009, 01:42 PM   #4 (permalink)
ioan1k
The Contributor
 
ioan1k's Avatar
 
Join Date: Mar 2009
Location: US
Posts: 76
Thanks: 0
ioan1k is on a distinguished road
Default

Are you send the header information before echoing the binary data?

You will need to send out the following headers.

php Code:
header('Content-type: image/png;');
header('Content-length: $iamgesize);

So you code will appear something like

php Code:
$data = mysql_query('SELECT data, filesize FROM images WHERE imageId = 1');
$data = mysql_fetch_assoc($data);
header('Content-type: image/png;');
header('Content-length: '.$data['filesize'].'');
echo $data['data'];

You cannot print out the data with other html content and must load the images through a php file, for example
html Code:
<div id="user">
    <img src="load-image.php?id=23" alt="Image" />
</div>
__________________
My Portfolio - Work - Need freelance Work?
I've been developing 5 years now, and I learn something new everyday
ioan1k is offline  
Reply With Quote