gallery.php is the main class for building the gallery. It calculates equal distributed columns etc.
So it’s not just a simple script. You could compare it to the Guggenheim - An algorithm for a perfectly balanced Gallery for Kirby but in a vertical not a horizontal order.
You can see a demo of it on my webpage
However that was before I did any kirby related work so it was a static page without a cms etc. At the moment the gallery itself is a standalone but as I need a gallery for a recent project, I thought of integrating it to kirby as a plugin (if it is possible ^^).