The code below:
if($file = $mongoGridFS->findOne(array('_id' => new MongoId($fileId))))
{
$fileName = $file->file['filename'];
$fileBytes = $file->getBytes();
header('Content-type: image/jpeg');
header("Content-Length: " . strlen($fileBytes));
ob_clean();
echo $fileBytes;
}
Returns the Response from Mongo as .jpg file.
How to include to this response some html? eg.
<div id='container'>
<img ... /> <!-- image generated by script and stored in $fileBytes -->
<br>
<span class='description'>This is image</span>
</div>
I want not to make <img src='...'>
linked to saved file on filesystem.
Is this possible?