How to display image from database in PHP?

By | March 19, 2016

Step1 : Fetch/Retrieve the image from datbase using database functions.
Step2 : Now use the image tag below.

<?php
$convertedImage ='CONVERTED_IMAGE_FROM_DB';
?>
<img src="data:image/jpg|gif|png;charset=utf8;base64,$convertedImage" />
jpg/gif/png depends on the type of image.

Leave a Reply

Your email address will not be published. Required fields are marked *