Page 1 of 1
store and display picturs from/into a blobfield
Posted: Wed Nov 13, 2002 7:53 am
by dpichowiak
How can I display a gif or jpg picture, from a blob filed.
or display a stored pfd/doc document.
(MySQL and PHP 4.2)
thanks
Dieter
Posted: Wed Nov 13, 2002 8:52 am
by twigletmac
When you attempt to display the file you need to make sure that you give the page the correct MIME content type:
http://www.utoronto.ca/ian/books/html4e ... etype.html
To do this you would put something like this, if for example you wished to display a gif, at the top of the script:
Code: Select all
header('Content-type: image/gif');
Mac
Posted: Mon Nov 18, 2002 3:43 am
by Elena Mitovska
For outputiing images from database Blob field I use folowing way:
first of all there are 2 php files:
index.php - that show image on page:
<img src='print_image.php?item_no=".$res[$i][0]."'>
This file calls other file 'print_image.php', that retrieves image from database:
$MainSQL="SELECT Photo FROM images where Item_no=".$item_no;
$res = $db->select($MainSQL);
$data = $res[0][0];
print $data;
so image is output in index.php file