I am just testing how well can mongodb gridFS handle image requests. The snippet gets the images from gridFS and displays them on a web page. The problem here, when I increase the limit from 25, images are not displayed. Is there a serving limit on gridFs or is my approach for testing wrong?
$gridFS = $db->getGridFS();
$objects = $gridFS->find()->limit(25);
while($object = $objects->getNext()){
echo " <img src=\"".$_SERVER['PHP_SELF']."?id=".$object->file['id']."\"> ";
}
if(isset($id) AND $id!=""){
$gridFSa = $db->getGridFS();
$object = $gridFSa->findOne(array('id'=>new MongoId($id)) );
header("Content-Length: " . strlen($object));
header("Content-Type: image/jpeg");
ob_clean();
echo $object->getBytes();
}