Ever heard of using jQuery plugins for such kind of work?
Well there are plenty of plugins available to show your bunch of images as tiles.
One of the good plugin is available on the following link.
You may use the above mentioned plugin or can google for the related ones.
Hope it helps.