Great idea! However, the term "knapsack algorithm" is quite misleading.<p>There is the "knapsack problem", but there are various different algorithms to solve it. Which of those has been used? Why this and not another algorithm? All those questions are concealed behind the squishy term "knapsack algoritm".
Whipped up a quick example, it seems to re-order the images in a way to fit the most it can on each row given the width constraints and the width of each image - <a href="http://jsfiddle.net/vXbCY/" rel="nofollow">http://jsfiddle.net/vXbCY/</a>
what is the "knapsack algorithm" ?<p>I understand how arranging images may be a "knapsack problem" but I can't pinpoint what <i>the algorithm</i> is supposed to be.
I believe this is similar to the layout used for G+ photos and Flickr's new justified view. Am I right?<p>We adapted the script below for <a href="http://current.openphoto.me/photo/list" rel="nofollow">http://current.openphoto.me/photo/list</a> --- curious to check this out as well.<p><a href="http://www.techbits.de/2011/10/25/building-a-google-plus-inspired-image-gallery/" rel="nofollow">http://www.techbits.de/2011/10/25/building-a-google-plus-ins...</a>
Plugin co-author here: One more possible extension of this algo would be to use value of each image equal to the weight of each image. This would ensure best fit and would be one more way to make things look beautiful and arranged.