problem sizing images

Discussion in 'ASP .Net' started by Jeff, Apr 3, 2009.

  1. Jeff

    Jeff Guest

    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?
    Jeff, Apr 3, 2009
    #1
    1. Advertising

  2. Jeff

    Jeff Guest

    i suppose I've fixed it by setting only the with tag:
    <asp:Image ID="Image1" runat="server" Width="500" />
    Jeff, Apr 3, 2009
    #2
    1. Advertising

  3. On Apr 3, 10:05 am, "Jeff" <> wrote:
    > 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.
    Alexey Smirnov, Apr 3, 2009
    #3
  4. On 3 Apr., 11:53, "Patrice" <http://www.chez.com/scribe/> wrote:
    > 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" <> a écrit dans le message de groupe
    > de discussion : #...
    >
    >
    >
    > > i suppose I've fixed it by setting only the with tag:
    > > <asp:Image ID="Image1" runat="server" Width="500"  />- Zitierten Text ausblenden -

    >
    > - Zitierten Text anzeigen -


    or you can resize on-the-fly
    http://www.google.com/search?q=asp.net resize on-the-fly
    Alexey Smirnov, Apr 13, 2009
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Allen Flick

    Sizing Images

    Allen Flick, Jan 7, 2004, in forum: HTML
    Replies:
    14
    Views:
    733
    Toby A Inkster
    Jan 15, 2004
  2. James O'Riley

    Sizing background images

    James O'Riley, May 2, 2006, in forum: HTML
    Replies:
    6
    Views:
    3,942
    Toby Inkster
    May 3, 2006
  3. dorayme
    Replies:
    0
    Views:
    371
    dorayme
    Feb 20, 2009
  4. MISS CHIEVOUS
    Replies:
    51
    Views:
    2,043
    MISS CHIEVOUS
    Apr 19, 2009
  5. Jimbo
    Replies:
    0
    Views:
    133
    Jimbo
    Jan 12, 2004
Loading...

Share This Page