Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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?

In reply to determining size of image by Anonymous Monk

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2023-01-29 22:56 GMT
Find Nodes?
    Voting Booth?

    No recent polls found