mercredi 7 décembre 2016

display greedfs image from controller to view

I have fetch greedfs image from Mongodb to laravel controller and displayed that image to controller then it displaying properly.

$grid = GridFsConnection(); //connection to db        
 $record = $grid->findone(array('filename'=>'documentupload/6815_2016120610070210'));
 $imagebody=$record;
 $imagebody = $record->getBytes();
 header('Content-type: image/jpeg');
 header("Content-Length: " . strlen($imagebody));
 echo $imagebody;
 ob_clean();

But when pass $imagebody to my view the it is displaying like unsupported file and stop displaying further html code



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire