Page 1 of 1

Problem with display image stored in MySql

Posted: Thu Feb 21, 2008 12:23 am
by Amigacom
Hello,

I have the problem with display a image that I store befor via form in MySql, in a BLOB field.
I read long time and many posts here, but I don't find a help for me...
I have a php file with following code:
<?php
include 'db_connect.php';

mysql_select_db("database") or die("Unable to select database");

$results = mysql_query("SELECT * FROM tbl_fotos WHERE f_id='17'");
echo mysql_error();
$nume=mysql_num_rows($results);

if ($nume > 0)
{
$ads = mysql_fetch_object($results);
$outImage = $ads["content"];
header('Content-Description: File Transfer');
header('Content-Type:image/jpeg');
header('Content-Length: '. strlen($outImage));

include 'db_close.php';
echo base64_decode($outImage);
?>

and try to display on a page with this code:
<?php
echo "<img src='getimage.php' alt='Foto 1' width=\"100\" height=\"80\">";
?>

what I'm doing wrong? I receive back the empty field from the image. No error...
I'm very gratefull for help, I'm trying tho display this pictures many days and I'm getting crazy...
This will be a page where the user register himself and can put 2 pitcures from him online.

Thanks for any help!!!!
Amigacom