PHP 8.5.0 Alpha 2 available for testing

Voting

: one plus five?
(Example: nine)

The Note You're Voting On

guy at bhaktiandvedanta dot com
22 years ago
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

<< Back to user notes page

To Top