Image Height and Width

Discussion in 'ASP .Net Web Controls' started by Thom Little, Jun 20, 2004.

  1. Thom Little

    Thom Little Guest

    I have images of varying sizes on the server and would like to display them
    on an aspx. This is easy to do (of course).

    imgTest.ImageUrl = "images/image01.jpg" ;

    I would like to reserve the display area before the images are loaded.

    How can I determine the original height and width of the image prior to it
    being loaded and displayed? Is there an article on the subject that you can
    point me towards?

    --
    -- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
    --
     
    Thom Little, Jun 20, 2004
    #1
    1. Advertising

  2. Thom Little

    DalePres Guest

    using System.Drawing;

    then in the method:


    Bitmap myBitmap = new Bitmap(@"c:\somepath.jpg")
    Size size = myBitmap.Size;

    or

    Bitmap myBitmap = new Bitmap(@"c:\somepath.jpg")
    int width = myBitmap.Width;
    int height = myBitmap.Height;

    Hope this helps,


    Dale

    "Thom Little" <> wrote in message
    news:%...
    > I have images of varying sizes on the server and would like to display

    them
    > on an aspx. This is easy to do (of course).
    >
    > imgTest.ImageUrl = "images/image01.jpg" ;
    >
    > I would like to reserve the display area before the images are loaded.
    >
    > How can I determine the original height and width of the image prior to it
    > being loaded and displayed? Is there an article on the subject that you

    can
    > point me towards?
    >
    > --
    > -- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
    > --
    >
    >
    >
     
    DalePres, Jun 21, 2004
    #2
    1. Advertising

  3. Thom Little

    Thom Little Guest

    That is EXACTLY the lead I needed.

    Thank you.

    --
    -- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
    --

    "DalePres" <> wrote in message
    news:...
    > using System.Drawing;
    >
    > then in the method:
    >
    >
    > Bitmap myBitmap = new Bitmap(@"c:\somepath.jpg")
    > Size size = myBitmap.Size;
    >
    > or
    >
    > Bitmap myBitmap = new Bitmap(@"c:\somepath.jpg")
    > int width = myBitmap.Width;
    > int height = myBitmap.Height;
    >
    > Hope this helps,
    >
    >
    > Dale
    >
    > "Thom Little" <> wrote in message
    > news:%...
    > > I have images of varying sizes on the server and would like to display

    > them
    > > on an aspx. This is easy to do (of course).
    > >
    > > imgTest.ImageUrl = "images/image01.jpg" ;
    > >
    > > I would like to reserve the display area before the images are loaded.
    > >
    > > How can I determine the original height and width of the image prior to

    it
    > > being loaded and displayed? Is there an article on the subject that you

    > can
    > > point me towards?
    > >
    > > --
    > > -- Thom Little -- www.tlaNET.net -- Thom Little Associates, Ltd.
    > > --
    > >
    > >
    > >

    >
    >
     
    Thom Little, Jun 21, 2004
    #3
    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. AndrewF
    Replies:
    1
    Views:
    786
    Bruce Barker
    Oct 10, 2005
  2. Sean Jorden
    Replies:
    1
    Views:
    600
    laurie
    Aug 19, 2003
  3. Lois
    Replies:
    1
    Views:
    3,247
    Ryan Stewart
    Dec 27, 2004
  4. cera
    Replies:
    1
    Views:
    1,277
    Neredbojias
    Aug 18, 2007
  5. Bernd Meier
    Replies:
    6
    Views:
    518
    GTalbot
    Jan 14, 2008
Loading...

Share This Page