Gallery Code
The code for rendering user galleries is very complex. Some details here in case I forget them (as has happened before...)
Dynamic resizing
The gallery code notes the aspect ratio of each image in a given gallery, and uses this to arrange images in neat rows of fixed width by adjusting the row height.
Gallery prefixes
Used to denote separate galleries on the same page, as a prefix to the start of each gallery element's ID.