guy at bhaktiandvedanta dot com
02-Oct-2002 08:00
You can use base64_encode to transfer image file into string text and then
display them. I used this to store my images in a database and display them
form there. First I open the files using fread, encoded the result, and
stored that result in the database. Useful for creating random images.
image.php:
<?
header(" Content-Type:
image/jpeg");
header(" Content-Disposition:
inline");
$sql = "SELECT data FROM image where
name='".$img."'";
$result = mysql_query($sql);
$row =
mysql_fetch_row($result);
$image = $row[0];
echo
base64_decode($image);
?>
And in the html file you
put:
<img src="image.php?img=test3"
border="0" alt="">
Guy Laor