Jump to content

Base64 vs Readfile: Display Secured Image


ChenXiu

Recommended Posts

Which is better? Why and why not?

An image is secured in the root directory, to be displayed to customer in html document.

This image can be displayed as a link to a php readfile page
The readfile page uses getimagesize("../rootdir/abc.png"), headers, and readfile()
echo "<img src='READFILE.php?image_name=abcd.png'>";
-or-
The image can be displayed directly to browser using
file_get_contents("../rootdir/abc.png"), base64_encode(), and data:image;base64.
echo '<img src="data:image;base64, ' .$img. ' " style="width:5in;height:5in;">';

Thank you.

Link to comment
Share on other sites

  • Barand locked this topic
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.