With this code here, the rest of your patch is so clean.  I like that.

None of this code needs to be in gallery.js, though, and I'd suggest you put it in a file named thumbnail_size.js or similar.  Whenever possible, I favor breaking up the monolithic code.  Gaia's build system will concatenate the files for us, so we don't have to worry about load time.  (We did originally which is why gallery.js is so big!)

Also, isSmallImage() is not a descriptive enough name for a global function because it doesn't say smaller than what.  And, computeThumbnailWidth() does not actually need to be global.  

So how about gallery.js just defines one global variable:

  var thumbnailSize = new ThumbnailSize()

thumbnail_size.js defines a single ThumbnailSize() constructor that is basically the content of computeThumbnailWidth(), and defines an object with width and height properties.

Then ThumbnailSize.prototype.isSmaller can be your isSmallImage function.

Elsewhere in the app, THUMBNAIL_WIDTH becomes ThumbnailSize.width and isSmallImage() becomes ThumbnailSize.isSmaller()