maccherons
Programmer
I have problems in visualizing images teken directly for my mySQL db.
I put the image in mySQL in a BLOB field, like I show in the following lines
where $bin_file is the binary I get from a form:
$data = addslashes(fread(fopen($bin_file, "rb"), filesize($bin_file)));
//esegui la query
$query = "INSERT INTO imgs (img) ".
"VALUES ('$data')";
and then retreive it with a normal query, say:
$query = "SELECT img FROM imgs WHERE id_img = $i_id";
To visualize it in a web page I have a php script where the core lines are this:
header('Content-Type: '.$img_mime);
header('Content-Disposition: "attachment"; filename='.$file_name);
print($img);
Now, the problem is that if you open that script with IE under winXP, it pops up to you
the choice open/save. Well, if you choose open, windows tells something like "no preview
available"; if you save it an then try to open the image you just can see it.
What's the problem? I can't work out this, I think it can be something in the way it passes
the stream, or the way IE bufferizes
Please, help
I put the image in mySQL in a BLOB field, like I show in the following lines
where $bin_file is the binary I get from a form:
$data = addslashes(fread(fopen($bin_file, "rb"), filesize($bin_file)));
//esegui la query
$query = "INSERT INTO imgs (img) ".
"VALUES ('$data')";
and then retreive it with a normal query, say:
$query = "SELECT img FROM imgs WHERE id_img = $i_id";
To visualize it in a web page I have a php script where the core lines are this:
header('Content-Type: '.$img_mime);
header('Content-Disposition: "attachment"; filename='.$file_name);
print($img);
Now, the problem is that if you open that script with IE under winXP, it pops up to you
the choice open/save. Well, if you choose open, windows tells something like "no preview
available"; if you save it an then try to open the image you just can see it.
What's the problem? I can't work out this, I think it can be something in the way it passes
the stream, or the way IE bufferizes
Please, help