Help: frames grow to fit content


I’m not sure where to ask for help, so I was wondering if it was ok for me to ask here…

I see this effect all over the place, mostly for photo galleries. Basically, before the photo is loaded, the box it will be loaded into isn’t visible… The box then animates into the required size for the photo, and the photo appears. If photos are of different sizes the frame they appear in grows/shrinks to fit them. Ofcourse I’m unable to find a suitable example though this site is ok…

See how the frame on the right changes sizes depending on the photo… I’m sorry I know I’m not explaining this too well. I’ll keep looking for a decent example after I post, update it if I can find one. (In this example the width doesn’t really change - only the height, ideally I’d want the entire box to be able to change size in accordance with the photos).

I guess you could animate the frame for each individual photo - but that seems inefficient, especially if there are large numbers of photos.

If you can understand what I’m trying to explain, does anybody know how I can achieve this? I’ve tried to search the web and kirupa but have been totally unsuccessful, and I love the technique.