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".
I understand how arranging images may be a "knapsack problem" but I can't pinpoint what the algorithm is supposed to be.
To the best of my knowledge there is no such thing as "The Knapsack Algorithm." (Except in the (now broken) Knapsack Public Key Encryption system)
The only references I've found in a quick search either incorrectly use the term "Knapsack Algorithm" when they actually mean "Knapsack Problem," or they simply refer to the obvious depth-first recursive search.
So the question remains - what algorithm are you using? Depth-first search? Dynamic programming? Greedy algorithm with heuristics and early cut-off? Simulated Annealing? Hill-Climbing? All of these can be used to find good solutions to an instance of the Knapsack Problem.
The auxiliary question: Given that the Knapsack Problem has been shown to be NP-Complete, what will your code do when given a hard instance?
We adapted the script below for http://current.openphoto.me/photo/list --- curious to check this out as well.
http://www.techbits.de/2011/10/25/building-a-google-plus-ins...
The Google+ and Google Image Search will resize and crop the image by width to fit a specified row, greedily optimizing for the maximum number of images per row.
Interesting you bring up [1] because I used a variation of that technique in my own site [2].
You can greatly simplify things if you resize all the images on the backend to the same width, then all you have to do is crop in the frontend to the minimum height in a row.
The trade off is the distortion happens by height rather than width, so you could end up cutting off someones head in a photo-gallery.
My patchwork solution now is to approximate the cropping that would be done in the rule of 3rds with a certain offset (so we lose dead space at the top).
A better technique would be to dynamically determine where a face was in the picture, and center on that. This plugin might help but you'd be better off passing that information from the backend. [3]
[1] http://www.techbits.de/2011/10/25/building-a-google-plus-ins...
How is the performance on this one?
That doesn't seem like a good idea just to arrange some images (battery killer?).