473,322 Members | 1,501 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,322 software developers and data experts.

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?
Mar 4 '08 #1
6 1371
SAM
dysfunct a écrit :
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();">

Mar 4 '08 #2
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.
Mar 4 '08 #3
On Mar 4, 11:47 am, dysfunct <Dysfunct...@gmail.comwrote:
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.
Mar 4 '08 #4
Thomas 'PointedEars' Lahn wrote:
dysfunct wrote:
>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".
>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
Mar 5 '08 #5
Bart Van der Donck wrote:
Thomas 'PointedEars' Lahn wrote:
>dysfunct wrote:
>>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".
>>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.
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
Mar 5 '08 #6
Logos wrote:
On Mar 7, 1:06 pm, Thomas 'PointedEars' Lahn <PointedE...@web.dewrote:
>[Full quote]
Please trim your quotes. http://jibbering.com/faq/
<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.
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.
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.
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.
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.
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.
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.
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
Mar 8 '08 #7

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

Similar topics

4
by: Luke StClair | last post by:
Only marginally belonging in this newsgroup... but oh well. I've just started writing in python, and I want to make the files available on the web. So I did the standard <a...
2
by: Dave | last post by:
Dear Sirs, Is there a way to get the width and height of an image without downloading the image, or with just downloading a minimal portion of the image? For instance, I have a list of 10,000...
0
by: TJ | last post by:
Hi, I've written code web-based uploading and downloading. Here is some code for it. For saving file into MS-SQL database, SaveFileIntoDB(HttpPostedFile file) { int fileLength =...
2
by: Bala | last post by:
Hi I am trying to download the PDF files from my webserver using ASP.Net. All my files are stored at F Drive on webserver. Like this F:\Main Folder\Sub Folder\Files\File1.pdf I am...
4
by: Joe | last post by:
I'm hosting my web service on a Windows 2003 box which is remotely located. When trying to add a web reference to a C# project I get an error message 'There was an error downloading...
5
by: fniles | last post by:
We created an ActiveX control and marked it as safe for scripting using Implements IObjectSafety. We then created a CAB file and signed it using Verisign. We also created a license file (LPK file)...
0
by: just.starting | last post by:
I am having problem while downloading files from an apache server2.0.53 with php4.3.10.While downloading some files it generally stops after downloading some specific amount and then stops...
23
by: Doug van Vianen | last post by:
Hi, Is there some way in JavaScript to stop the downloading of pictures from a web page? Thank you. Doug van Vianen
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
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...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.