You appear to have answered your own question.
Alternatively, and less facetiously, there are lots of options.
I have one in Java.
Create image container and have it point to the back code (in my case a java one) and remember to create thumbs.
Here[
^] is a recommended, and free, downloadable gallery.
Even if it is not what you want, it will show you how it works.