Can JavaScript be used to display the remaining file size (in kb) needed to fully download a gif file from a remote server?
function downgif(id, img){
//show downloading
Show('downloadgif');
//change image
document.getElementById(id).src=img;
//test if complete
var completeInterval = null, renderedInterval = null, count = 0;
var theImg = document.getElementById(id);
theImg.src = img;
// Wait for image to be loaded (but not necessarily rendered)
completeInterval = setInterval(function() {
if (theImg.complete) {
// Cancel checking once IMG is loaded OR we've tried for ~9s already
clearInterval(completeInterval);
completeInterval = null;
// IMG is now 'complete' - but that just means it's in the render queue...
// Wait for naturalWidth and naturalHeight to be > 0 since this shows
// that the image is done being RENDERED (not just 'loaded/complete')
renderedInterval = setInterval(function() {
if (theImg.naturalHeight > 0 && theImg.naturalWidth > 0) {
clearInterval(renderedInterval);
renderedInterval = null;
//hide downloading
Hide('downloadgif');
}
}, 100);
}
}, 450);
}