ChenXiu Posted August 6, 2021 Share Posted August 6, 2021 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 https://forums.phpfreaks.com/topic/313505-base64-vs-readfile-display-secured-image/ Share on other sites More sharing options...
Barand Posted August 6, 2021 Share Posted August 6, 2021 You have already posted this question. Closing. Link to comment https://forums.phpfreaks.com/topic/313505-base64-vs-readfile-display-secured-image/#findComment-1588891 Share on other sites More sharing options...
Recommended Posts