Tweaking forloop for index based lorempixel image retrieving