473,320 Members | 2,048 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,320 software developers and data experts.

finding jpg dimensions with javascript?

Hi

Is it possible to get the dimensions of a jpg file using javascript?

I'd like to open a sub-window to display an image and have window slightly
larger (for example, 100pixels wider and taller) than the image.

Thanks
Rob
www.rcp.ca

Aug 2 '05 #1
1 1888


rob c wrote:
Is it possible to get the dimensions of a jpg file using javascript?


On the client, once the browser has loaded the image file, it usually
exposes the dimensions:

var img = new Image();
img.src = 'kiboInside.jpg';
img.onload = function (evt) {
alert(this.width + 'x' + this.height);
};

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 2 '05 #2

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

Similar topics

10
by: TheKeith | last post by:
I don't know much about javascript, so take it easy on me. Is there a way to dynamically change a CSS layers dimensions on the fly. Here is what I'm doing. I have a bunch of thumbnails that when...
1
by: John | last post by:
I am rotating images of different dimensions. My problem is that when a new image is displayed in a new position which had an image of a different dimension, the old image is first stretched to the...
15
by: cwsullivan | last post by:
Hi gang, I have a grid full of particles in my program, and I want to find an angle between two particles. I'm having trouble because it seems like the answer depends on whether or not the target...
1
by: Rico | last post by:
Hello, I have an ole object field (Access XP/2002) which I store images in. I have a couple of questions regarding this; is it possible to determine the image dimensions? Secondly, is there...
5
by: jarjis | last post by:
Hi All, Im new to the web development.... Here I wanna know some codes which support the following criteria.. 1) Restricting other files except image files. 2) Restricting image file with the...
1
by: Mentat | last post by:
In the description below ??? marks specific problem areas. Any help is appreciated. Required ======== A method to detect the width and height values of a <DIV... element. Since there are two...
1
by: T0mm0 | last post by:
I'm using a WYSIWYG HTML editor that supports vertical and horizontal scrolling. I want to limit the area that users can edit. My editor doesn't support this so I need to come up with some way to...
3
by: T0mm0 | last post by:
I'm using a WYSIWYG HTML editor that supports vertical and horizontal scrolling. I want to limit the area that users can edit. My editor doesn't support this so I need to come up with some way to...
2
by: AAaron123 | last post by:
I have an image inside a table cell. I'd like to scale the image to fill the cell. I have a javascript routine that can change the image's height but can't seem to fine a place to call it with...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.