473,791 Members | 2,711 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getting image size

Hi,
how can I retrieve the height and width of
a System.Web.UI.W ebControls.Imag e after populating it's ImageUrl property.
It's seems not to be filled ?
Does someone have a solution ?
Thanks
Karim

Nov 18 '05 #1
3 4234
You can't. These values aren't available at that time because the image
itself isn't loaded into the form. All it's doing is telling the browser
where to get the image from. The width and height can be set independantly
of the image. For example. you can specify a 100 pixel width for an image
even though it's a 1 pixel spacer. Essentially though, getting the image
value won't do you any good in an Image webcontrol because, since the image
is never really opened server-side, the server doesn't actually know the
size of the image. You would have to open it as a bitmap using some of the
System.Drawing classes to really open the image first in order to find the
size.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

"karimL" <no************ @ligne-bleue-cyber.com> wrote in message
news:40******** ******@ligne-bleue-cyber.com...
Hi,
how can I retrieve the height and width of
a System.Web.UI.W ebControls.Imag e after populating it's ImageUrl property.
It's seems not to be filled ?
Does someone have a solution ?
Thanks
Karim

Nov 18 '05 #2
If you need the information you can retrieve it by something like

Dim img As System.Drawing. Image
img = System.Drawing. Image.FromFile( "blah.jpg")

myWebControlIma ge.Width = img.Width
myWebControlIma ge.Height = img.Height

Hope that helps.

-D
"karimL" <no************ @ligne-bleue-cyber.com> wrote in message
news:40******** ******@ligne-bleue-cyber.com...
Hi,
how can I retrieve the height and width of
a System.Web.UI.W ebControls.Imag e after populating it's ImageUrl property.
It's seems not to be filled ?
Does someone have a solution ?
Thanks
Karim

Nov 18 '05 #3
Thanks for your advices...
but i need to get the Image height because i dynamically resize the height
of my webcontrol based
on image height.
More i just have the url (relative parth) to the the image but in design
time mode all variables concerning Server or Context
ar not set ?.... so I can't use MapPath function to obtain the physical
parth of the picture ... then second question is how to obtain the
physical path from relative path in Design Mode...

Thanks
Karim

"karimL" <no************ @ligne-bleue-cyber.com> a écrit dans le message de
news:40******** ******@ligne-bleue-cyber.com...
Hi,
how can I retrieve the height and width of
a System.Web.UI.W ebControls.Imag e after populating it's ImageUrl property.
It's seems not to be filled ?
Does someone have a solution ?
Thanks
Karim

Nov 18 '05 #4

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

Similar topics

3
11767
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 table in MySQL with the path & filename to the image. I have successfully uploaded and performed an update query on the database, but the problem I have is I cannot retain the primary key field in a variable which is then used in a SQL update...
1
2128
by: Ron Vecchi | last post by:
I am using asp.net to upload an image and then perform resizing on it and saving the different sizes to file. The resized images were coming up and being displayed in the bowser fine but the image sizes are a lot bigger(in file size) than the actual image being uploaded. The actual image being uploaded was around 22000bytes The smaller resized image is 120000bytes Also on the web when the resized image is displayed it starts out with a...
11
2025
by: KarimL | last post by:
Thanks for your advices... but i need to get the Image height because i dynamically resize the height of my webcontrol based on the image height. More i just have the url (relative parth) to the the image but in design time mode all variables concerning Server or Context ar not set ! ...so I can't use MapPath function to obtain the physical parth of the picture ... So my second question is how to retrieve the physical root path of the...
2
1238
by: Brett Baisley | last post by:
Hello I need help with some ASP.net programming. I have a web page that basically just has the following web components: dropdownlist, listbox and image. I am using VB.net with a CodeBehind file to read the contents of a directory into the dropdownlist. Then when the user picks one, it displays a list of the images in that dir in the listbox. Then when you pick a filename from the listbox, it displays the image.
2
1412
by: sharma | last post by:
Hi, I Have a page which will take authentication from a diffrent page from a difrent website. My program needs to call a page like this from php page lets say: www.abc.com?handshake.jsp?userid=ettey1234&authtoken=94399843 my php page is at www.xyz.com
2
4755
by: abrtlt | last post by:
I am using Ajax with a PHP script to obtain the name of gif files from a MySQL database. Javascript then embeds the actual file in the web page, thus displaying the image on the fly. For precise positioning, I would like to know the gif image size. Is there a way to obtain it using Javascript or otherwise? (I know the size is indeed contained in the gif format, as I can see it with a binary editor...) Thanks! Andrew
2
4557
by: Jerry Spence1 | last post by:
I am trying to come up with a focussing routine for a camera and I need to detect when the image is in focus. As I understand it, JPG Image size goes up sharply when it is in focus as it is very sensitive to the presence of sharply defined edges (high spatial frequency information). I have the following routine which gets the image from the camera into NewPic. I am trying to find the size in bytes of this image and I don't want to write...
3
22535
by: Andrzej | last post by:
I have a picturebox on my C# .NET form. The picturebox size mode is set to zoom. I then load an image into that form and display it. As the user moves the mouse over the form, I want to get and display (in the status bar) the image coordinates of the mouse location. However, if I use the picturebox's MouseMove event, I am getting the coordinates of the mouse over the PICTUREBOX, not the actual image underneath that (which is zoomed). i.e....
1
4251
AaronL
by: AaronL | last post by:
Hello, First I would like to say thank you all for your help in the past. I am stumped again. I am creating an e-commerce system and I want to be able to upload images to the server and assign them to products. For the product ID, I have an auto increment value for the primary key to avoid duplicate item numbers. Since I do not want to pass all of my record values to my image upload program (when I write it), I assume to just submit...
0
9669
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10426
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10207
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10154
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9993
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7537
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5558
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3713
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2913
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.