Connecting Tech Pros Worldwide Help | Site Map

Any way to see if an img is done downloading?

 
LinkBack Thread Tools Search this Thread
  #1  
Old March 4th, 2008, 02:05 PM
dysfunct
Guest
 
Posts: n/a
Default Any way to see if an img is done downloading?

Question: If I have a lot of <imgtags on a site, all linking from
all sorts of domains, is there a way to check to see which ones have
finished downloading and which ones haven't? For example let's say I
have

<div>
<img src="something.com/pic.jpg">
<img src="somethingelse.com/pic.jpg">
<img src="somethingelse.com/pic.jpg">
<img src="somethingelse.com/pic.jpg">
<img src="somethingelse.com/pic.jpg">
<img src="somethingelse.com/pic.jpg">
</div>

And I want to display a loading gif untill all the images are
completely downloaded. Is there a way to check?

  #2  
Old March 4th, 2008, 02:25 PM
SAM
Guest
 
Posts: n/a
Default Re: Any way to see if an img is done downloading?

dysfunct a écrit :
Quote:
Question: If I have a lot of <imgtags on a site, all linking from
all sorts of domains, is there a way to check to see which ones have
finished downloading and which ones haven't? For example let's say I
have
>
<div>
<img src="something.com/pic.jpg">
<img src="somethingelse.com/pic.jpg">
<img src="somethingelse.com/pic.jpg">
<img src="somethingelse.com/pic.jpg">
<img src="somethingelse.com/pic.jpg">
<img src="somethingelse.com/pic.jpg">
</div>
>
And I want to display a loading gif untill all the images are
completely downloaded. Is there a way to check?

<body onload="stopAnim();">

  #3  
Old March 4th, 2008, 04:55 PM
dysfunct
Guest
 
Posts: n/a
Default Re: Any way to see if an img is done downloading?

Quote:
That's completely pointless. The UA will not only have to download your
image switching script but also your "loading gif".
Actually it's not pointless - suppose i just wasn't explaining it
enough. Let's say the div and all the img tags are added after the dom
is initially ready. Also, let's say there are 600 img tags and the
images are all between 100 and 300 kb. Now lets say that the setup is
more complicated than just a div with imgs in it, and the appearance
of the whole thing is contingent upon those images being downloaded
and displayed. So if the images take a total of (arbitrarily) 45
seconds to download, I don't want that portion of the page to look
terrible while the images are loading, so i want to show a simple
loading gif (say 10kb) instead until the images have finished.
  #4  
Old March 4th, 2008, 06:05 PM
endangeredmassa@gmail.com
Guest
 
Posts: n/a
Default Re: Any way to see if an img is done downloading?

On Mar 4, 11:47 am, dysfunct <Dysfunct...@gmail.comwrote:
Quote:
Quote:
That's completely pointless. The UA will not only have to download your
image switching script but also your "loading gif".
>
Actually it's not pointless - suppose i just wasn't explaining it
enough. Let's say the div and all the img tags are added after the dom
is initially ready. Also, let's say there are 600 img tags and the
images are all between 100 and 300 kb. Now lets say that the setup is
more complicated than just a div with imgs in it, and the appearance
of the whole thing is contingent upon those images being downloaded
and displayed. So if the images take a total of (arbitrarily) 45
seconds to download, I don't want that portion of the page to look
terrible while the images are loading, so i want to show a simple
loading gif (say 10kb) instead until the images have finished.
If the size of the image is what makes the layout look proper, then
consider adding the height and width attributes to your image tags.
That way, they will occupy that much space before the image is loaded.

Another option would be to place divs instead of img tags, then use
AJAX requests to grab the images. You can then check the readyState to
see when the image has been downloaded and act accordingly--perhaps by
changing the innerHTML of the div element to have the img tag.
  #5  
Old March 5th, 2008, 02:05 PM
Bart Van der Donck
Guest
 
Posts: n/a
Default Re: Any way to see if an img is done downloading?

Thomas 'PointedEars' Lahn wrote:
Quote:
dysfunct wrote:
>
Quote:
>And I want to display a loading gif untill all the images are
>completely downloaded.
>
That's completely pointless. *The UA will not only have to download your
image switching script but also your "loading gif".
>
Quote:
>Is there a way to check?
>
At least not an interoperable or efficient one.
Sure there is. You simply use immature criteria to judge what's good
software and what's not.

--
Bart
  #6  
Old March 5th, 2008, 02:45 PM
Thomas 'PointedEars' Lahn
Guest
 
Posts: n/a
Default Re: Any way to see if an img is done downloading?

Bart Van der Donck wrote:
Quote:
Thomas 'PointedEars' Lahn wrote:
Quote:
>dysfunct wrote:
Quote:
>>And I want to display a loading gif untill all the images are
>>completely downloaded.
>That's completely pointless. The UA will not only have to download your
>image switching script but also your "loading gif".
>>
Quote:
>>Is there a way to check?
>At least not an interoperable or efficient one.
>
Sure there is.
Can you place your money where your mouth is? I doubt it.
Quote:
You simply use immature criteria to judge what's good
software and what's not.
That's coming from someone who is unable to recognize the script-kiddie code
quality of

// wz_dragdrop.js:83
for(var dd_i = dd_cursors.length; dd_i;)
{--dd_i;
eval('var CURSOR_' +
(dd_cursors[dd_i].substring(2).toUpperCase().replace('-', '_')) + ' = "' +
dd_cursors[dd_i] + '";');
}


PointedEars
  #7  
Old March 8th, 2008, 03:35 PM
Thomas 'PointedEars' Lahn
Guest
 
Posts: n/a
Default Re: Any way to see if an img is done downloading?

Logos wrote:
Quote:
On Mar 7, 1:06 pm, Thomas 'PointedEars' Lahn <PointedE...@web.dewrote:
Quote:
>[Full quote]
Please trim your quotes. http://jibbering.com/faq/
Quote:
<shrug The gentleman asked a question, and I answered it. I don't feel
that I've been called to stand in judgment of what he wants or how he
does it. I saw a question I could contribute to, and I tried to help.
But you did not help. You gave bad advice and have been corrected.
Quote:
You, on the other hand, have merely delivered condescending commentary
without actually providing any *help*.
This is not a support forum. BTW, just in case you don't happen to know,
this is not a Web forum either.
Quote:
You told him what he wanted to do was pointless and inefficient based on
your own views and ideas,
Based on my experience and well-founded opinion, yes.
Quote:
which is fine although you were IMHO somewhat unpleasant about it
I am not afraid to call nonsense "nonsense", if that is what you mean.
Quote:
and in follow up posts, but then you didn't offer any actual constructive
advice. Criticism like that is not constructive,
Quite the contrary. Sometimes the best advice is the recommendation not to
do something.
Quote:
and regardless of whether you feel you know what you are talking about,
you still have to back up what you're saying in a post.
I have backed it up several times now. This is a *news*group.
Quote:
No first time or infrequent poster is going to read thru the entire
newsgroup just to establish your street cred.
This is not about me, it is about giving good advice, and bad advice
incidentally coming from you.
Quote:
Aaaaaand we're done feeding the trolls for the day!
Who is the troll here, who engages in side arguments, who is attacking the
person instead of providing a solid argumentation for his opinion, is pretty
clear by now. Go away.


PointedEars
--
realism: HTML 4.01 Strict
evangelism: XHTML 1.0 Strict
madness: XHTML 1.1 as application/xhtml+xml
-- Bjoern Hoehrmann
 

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,989 network members.