here is my code to display image stored in GridFS to HTML page.
$conn = new MongoClient('SHLY_DBSERVER');
$db = $conn->newdb;
$gridFS = $db->getGridFS('productImages');
$image = $gridFS->find();
$im_array=iterator_to_array($image);
return $im_array;
by passing the $im_array to the view..
foreach ($im_array as $key => $value)
{
$imageFile = $value->getBytes();
$img=base64_encode($imageFile); ?>
<img style="width:300px;margin-left: 5em" class="img-responsive" src="data:image/jpg;charset=utf8;base64,<?php echo $img ?>"/><br>
}
is it a good practise to display normal webpage images? should i go for file system storage ?