 <p>Why not using <a href="https://github.com/amirarcane/recent-images" rel="nofollow">recent-images</a> library? It makes thumbnails of device photos and set them in gridview, you can custom it for your purpose.</p>