I need to show a list of image thumbnails, and the user should be able to select one or more images from this list and then the selected images should be "best fit" displayed. For example, with 3 selections a triangular presentation should be used, with 4 selections a square, and so on.
I'd use jQuery with the jQueryUI add-on "Selectable".
Using this, make images selectable and customize the stylesheet to align your images and emphasize the selected ones.
Then, when images are selected, trigger a
function that fits the images to your needs. You'll need to add your own logic to the fitting.