problem sizing images

J

Jeff

hi

asp.net 2.0

I have this markup on my webpage. The problem with this markup is that a
picture can appear to be stretched. Specially is this notable on portrate
photos - photos where height is higher than width

<asp:Image ID="Image1" runat="server" Width="700" Height="300" />

So I'm looking for a way to keep the relationship between the height and
width. Lets say original picture has size with:800, height:600. Then I want
to keep the relationship between those properties while I scale down the
picture so it's not larger than with:700 and height:500... maybe in this
scenario the with should be 500 and height 300...

any suggestions?
 
J

Jeff

i suppose I've fixed it by setting only the with tag:
<asp:Image ID="Image1" runat="server" Width="500" />
 
A

Alexey Smirnov

hi

asp.net 2.0

I have this markup on my webpage. The problem with this markup is that a
picture can appear to be stretched. Specially is this notable on portrate
photos - photos where height is higher than width

<asp:Image ID="Image1" runat="server" Width="700" Height="300" />

So I'm looking for a way to keep the relationship between the height and
width. Lets say original picture has size with:800, height:600. Then I want
to keep the relationship between those properties while I scale down the
picture so it's not larger than with:700 and height:500... maybe in this
scenario the with should be 500 and height 300...

any suggestions?

You can use CSS for this. For example,

..resize {
width: 300px;
height : auto;
}


It will resize the images by keeping width as 300 pixels.

Use CssClass property of <asp:Image> to set class to the control

Hope this helps.
 
A

Alexey Smirnov

Not sure what is the original size but keep in mind that you still have to
download the image file even if this is just to display a much smaller
version. So sometimes it's best to size the image when it is saved to the
server so that you can have a  native version that has just the size (both
in pixels and resulting file size) you need....

--
Patrice

"Jeff" <[email protected]> a écrit dans le message de groupe
de discussion : #[email protected]...




- Zitierten Text anzeigen -

or you can resize on-the-fly
http://www.google.com/search?q=asp.net+resize+on-the-fly
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top