Im fetching an blob image from my database, but it returns broken.
If i remove
header("Content-Type: image/jpeg");
it returns the file extension at it should be since its a PNG file
‰PNG IHDR\r¨fÆÉIDAT
Any ideas whats the problem ? And yes. i tried the
header("Content-Type: image/png");
also
I have tried with ob_start and ob_end_flush();
code
ob_start();
$query = $db->query("SELECT `image` FROM `userdetails` WHERE id = '{$_SESSION['uid']}' ");
$row = $query->fetch(PDO::FETCH_ASSOC);
echo $row['image'];
header("Content-Type: image/jpeg");
ob_end_flush();
thanks
What you ask about in your question is subject to many parameters of which I fear your question does - if at all - scratch only some of them.
What pops into the eye is the PNG header:
‰PNG IHDR\r¨fÆÉIDAT
does not look broken. So you probably did have a problem to store the image into the database. Maybe the data was truncated / modified and this change got unnoticed?
One way to deal with that is to create a checksum of the files before putting them into the blob to be able later on to verify the data-integrity.
0 comments:
Post a Comment