This project will automatically arrange a grid of photos using variable dimensions for the item size. Handy for seeing what different grid sizes will look and feel like.
As a bonus(!), I commented the hell out the code, excessively and extensively, as a test to see if I could put into words what was going on. Take a look, especially if you're struggling with iterations, classes, or assigning events within loops.