Hi All,
I have a problem regarding getting the files size of an image.
Sometimes this script detects the image size other times it doesn't. I can select the same image without reloading the page and occasionaly it won't give the file size.
It's really trciky to figure out. Any advice on how to track the problem of any ways of writting the code better would be great.
Thanks,
Richard
I have a problem regarding getting the files size of an image.
Sometimes this script detects the image size other times it doesn't. I can select the same image without reloading the page and occasionaly it won't give the file size.
It's really trciky to figure out. Any advice on how to track the problem of any ways of writting the code better would be great.
Code:
x=new Image;
x.src=element.value;
iw=x.width;
nw=100/x.width
ih=x.height;
nh=nw*ih;
is=Math.ceil(x.fileSize/1000);
// Set row value
new_row.innerHTML = '<img src="file:///'+element.value+'" width="100" height="'+nh+'" />';
// Add the file sizes
if(isNaN(is) != true) {
thesize = document.getElementById('uploadSize')
oldsize = parseInt(thesize.value,10);
thesize.value = oldsize + is;
document.getElementById('upload_size').innerHTML = thesize.value;
}
Thanks,
Richard