Hi,
I have some trouble displaying images, which I inserted in a mysql db:
$data = addslashes(fread(fopen($form_data, "r"), $form_data_size));
$qry = "INSERT INTO images (data,filename,filesize,filetype) ".
"VALUES ('$data','$form_data_name','$form_data_size','$form_data_type')";
The file including data seems to be stored fine when looking at the databases tables.
However, if I try to display that image using
<IMG src='getimage.php?id=1'> where getimage.php looks sth. like this:
if($id && $conn_id) {
$query = "SELECT data,filetype FROM images WHERE id=$id";
$result = mysql_query($query,$conn_id);
if($result) {
$data = mysql_result($result,0,"data");
$type = mysql_result($result,0,"filetype");
Header( "Content-type: $type");
echo ($data);
flush();
}
}
In case of og GIFs, I can see about 10% of the image, the next 20% looks scrambled and the rest of the image is missing (btw: it doensn't make any difference wheter I leave or change or delete the content-type line)
Trying to show JPGs, internet explorers red cross shows up insistently! No image.
This all works perfect without any modifications on UNIX Systems!
My config:
PHP 4.0.2 as ISAPI on Windows2000 with MySQL 3.22.30
Thanks a lot for help!
Tom