http://www.perlmonks.org?node_id=601588

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I know how to get the size of an image via Image::Info, but I want to add a little snippet that does a little more.

I have a picture posting site where users can upload images to and some are too large and ends up making horizontal scrollbards on the browser (not acceptable!). I can now detect which images are larger than 800x600, which is what I want to test against, but how can I dynamically resize the HTML renderation of the image?

I'm NOT trying to resize the image itself, just the HTML code of the image. Ie. <code> I'm just using HTML to make it appear smaller on screen so the user can click the image to make it appear full in a new window.

So let's say the image was 1100x900, I want to use the HTML image size to show the image at the first size in which both dimensions are smaller than my required size (800x600). In short, I want the resize to be proportioned to the size of the image itself. I COULD just resize everything that's too large to 800x600 but that'd cause a lot of crappy images, I want to keep the same proportions.

Can anyone help me with this?