Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: HTML image resizing with Image::Info based on max height/width

by varian (Chaplain)
on Jun 12, 2007 at 07:12 UTC ( [id://620650]=note: print w/replies, xml ) Need Help??


in reply to HTML image resizing with Image::Info based on max height/width

I know how to determine height and width with Image::Info but I need to know how I can HTML resize (yes, just HTML. I know it'll load the whole image anyway but it'll fit better)
Well, if you plan to send the entire high-resolution picture to the web browser anyway then there is no need to resize at all. :-)

Just send either the maximum allowed height or the maximum width along with the image to the browser and the browser will calculate the other length such that the image is shown/resized proportionally.

Note: Even though the above will work, you can save the network and the web client a lot of bandwidth and cpu cycles if you properly resize the picture server side and just transport a downsized picture over the network.

  • Comment on Re: HTML image resizing with Image::Info based on max height/width

Replies are listed 'Best First'.
Re^2: HTML image resizing with Image::Info based on max height/width
by Anonymous Monk on Jun 20, 2007 at 14:24 UTC
    There is an easy way to do it in HTML... If you want a fixed width or a fixed height: - Fixed height (the width will be adjusted automatically keeping the ratio of the picture) <img src="07cat.jpg" height="96" /> - Fixed width (the height will be adjusted automatically keeping the ratio of the picture) <img src="07cat.jpg" width="96" /> I hope this will help too...
      A bit of old school HTML. <img src="index.jpg" width="800" height="*"> The asterisk keeps it proportional, no matter the original size. Asterisks also work with table dimensions.
      It should also be noted that the following is very useful, dynamic resizing based on the window and element sizes:
      <img src="index.jpg" width="90%" height="*">

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://620650]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-20 00:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found