I am trying to lay out pictures on a web page, having read in all the filenames from a database. This isn't a problem, except that the pictures aren't all the same size. I would like to lay them out in 2 columns side by side, with each picture being no wider than 300 pixels and no taller than 300 pixels. If the picture is wider than 300 pixels and shorter than it is wide, I'd like it to display the picture 300 pixels wide with the height scaled down proportionally and if the picture is taller than 300 pixels and taller than it is wide, I'd like it to display the picture 300 pixels tall and scale the width down proportionally. If the picture is smaller than 300 pixels both in width and height then I'd probably want to scale it up until the larger of width or height was 300 pixels. Is there any way to do this in html or even javascript?
I hope I was clear with what I'm trying to do...
Thanks