Is there a jQuery plugin that can do a centered clustered layout like this for a bunch of thumbnails of varying widths and heights?

I was looking into the Masonry, Isotope, and Workman jQuery plugins, but they’re fails as far as I could find. They look great, but they only seem to work well with re-sized images of the same width, or widths that are divisible by the smallest width.
Because my landscape thumbnails can have different widths and my portrait thumbnails can have different heights, these plugins aren’t looking too hot.
I considered going fixed width to conform to these plugins, but it makes all the landscape thumbnails way too small.
Does anyone know of an alternative to these plugins, or a way to configure these to achieve the layout above for various sized thumbnails?
I can think of a circle packing algorithm for example in this question: Arranging circles in data visualisation. It solved a similar problem like Masonry or Isotope.