Connecting Tech Pros Worldwide Help | Site Map

Can javascript give me image dimensions?

 
LinkBack Thread Tools Search this Thread
  #1  
Old July 20th, 2005, 10:45 AM
Randell D.
Guest
 
Posts: n/a
Default Can javascript give me image dimensions?


Folks,
I want to create a popup for thumbnail images (jpg, png, gif) and wonder if
I can create a popup that opens a new window whereby the image fits the new
window 100%... I know I can have my Apache/PHP server do this, but my
preference leans towards clientside javascript...

Thus... can javascript calcuate the width/height of an image for me to do
the above?

thanx

--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?



  #2  
Old July 20th, 2005, 10:47 AM
Randell D.
Guest
 
Posts: n/a
Default Re: Can javascript give me image dimensions?


"Randell D." <you.can.email.me.at.randelld@yahoo.com> wrote in message
news:uYvcb.17624$TM4.16131@pd7tw2no...[color=blue]
>
> Folks,
> I want to create a popup for thumbnail images (jpg, png, gif) and wonder[/color]
if[color=blue]
> I can create a popup that opens a new window whereby the image fits the[/color]
new[color=blue]
> window 100%... I know I can have my Apache/PHP server do this, but my
> preference leans towards clientside javascript...
>
> Thus... can javascript calcuate the width/height of an image for me to do
> the above?
>
> thanx
>[/color]

Got it... from an old post...

<script Language='javascript1.2' type='text/javascript'>
<!--
function iLoad(isrc) {
var oImg = new Image();
oImg.src = isrc;
if (oImg.complete) {
window.alert(oImg.src + ' ' + oImg.width + ' x ' + oImg.height);
}
else {
window.setTimeout('iLoad(imgsrc)', 1000);
}
}
//-->
</script>
</HEAD>
<body onLoad='iLoad(imgsrc)'>
</body>
</HTML>


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.