473,396 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Image Size Determination

I would like to dynamically add a .jpg image of arbitrary size to an .aspx
page and reserve the space for the image before it is loaded. Loading the
image is no problem. How can I determine the height and width of the image
before it is loaded? Is there an article that you can point me to on the
subject?

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

Nov 16 '05 #1
2 1230
Thom,

In order to do this, you will have to load the image on the server side.
Once you do that, you can place the height and width properties in the IMG
tag, which will (I think) cause the browser to reserve space for that image
before it is downloaded (since it knows the dimensions already).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Thom Little" <th**@tlanet.net> wrote in message
news:Op**************@TK2MSFTNGP09.phx.gbl...
I would like to dynamically add a .jpg image of arbitrary size to an .aspx
page and reserve the space for the image before it is loaded. Loading the
image is no problem. How can I determine the height and width of the image before it is loaded? Is there an article that you can point me to on the
subject?

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

Nov 16 '05 #2
Thank you.

With some help I was able to come up with the following ...

private void Page_Load(object sender, System.EventArgs e)
{
imgTest2.ImageUrl = @"d:\Client\tlacsharp\private\3\large\01.jpg" ;
Bitmap myBitmap = new Bitmap( imgTest2.ImageUrl );
txtTest2.Text = myBitmap.Height + " x " + myBitmap.Width ;
}
... where there is simply a Text Box for reporting and an image with no
dimensions specified.

The reason I want this is because I want to cycle through all the images in
a directory and find the dimensions of the largest one. I can then reserve
space for the largest one on the page and cycle all the images through that
reserved space.

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

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2***************@TK2MSFTNGP11.phx.gbl...
Thom,

In order to do this, you will have to load the image on the server side. Once you do that, you can place the height and width properties in the IMG
tag, which will (I think) cause the browser to reserve space for that image before it is downloaded (since it knows the dimensions already).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Thom Little" <th**@tlanet.net> wrote in message
news:Op**************@TK2MSFTNGP09.phx.gbl...
I would like to dynamically add a .jpg image of arbitrary size to an ..aspx page and reserve the space for the image before it is loaded. Loading the image is no problem. How can I determine the height and width of the

image
before it is loaded? Is there an article that you can point me to on the subject?

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


Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ken | last post by:
How does IE6 control the display of images? I change the content of a image file image1.jpg without changing the file name. Then jump to a new page to display it. IE6 does not displays the...
3
by: dave | last post by:
Hello there, I am at my wit's end ! I have used the following script succesfully to upload an image to my web space. But what I really want to be able to do is to update an existing record in a...
8
by: Chris Dewin | last post by:
Hi. I run a website for my band, and the other guys want an image gallery. I'm thinking it would be nice and easy, if we could just upload a jpg into a dir called "gallery/". When the client...
1
by: John Thompson | last post by:
We're sooo close. When we load the page to upload the image, all of the prms go through except the binary image data. Using SQL server with the data type set to "image". Please help! Thanks-...
6
by: nichughes | last post by:
Hello all, A question relating to http://www.entrust-systems.net/ Just for a change I have run into a problem that seems to be OS specific rather than browser specific - the box image that is...
2
by: derekbarrett | last post by:
Hi, I found this article in DB2 magazine and learned about the Problem Determination Mastery Exam. I am very interested in taking the exam, however, following the links in the article leads to...
3
by: =?Utf-8?B?SlIx?= | last post by:
I would like to add text to an image. I have tried to use DrawString and it works on some images but on others it is very very small. I am pretty sure it has something to do with the size of the...
2
by: Adam Teale | last post by:
hey guys Is there a builtin/standard install method in python for retrieving or finding out an image's dimensions? A quick google found me this:...
5
by: aj | last post by:
SQL Server SP2 9.0.3042 64-bit I recently put my first SQL Server DB in production. In the "other" database that I use (not interested in any arguments), you can indicate the desired size of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.