I have an ASP page which generates flat HTML from content in a database. Some of this content is paths to images. Because I dont have the actual image dimensions in the database, I am using Javascript in the flat 'generated' HTML pages to detect the image dimensions and then using these dimensions in the <IMG> tag.
The problem I am having is this...
If I generate a page and then view it and decide the image is the wrong shape then I may well go into Photoshop and crop the image and reupload it. When I go back into the browser and view the page, the image is updated but is keeping the dimensions of its previous version.
How can I get the dimensions of the image to be redetected from fresh every time??
Please help this is driving me crazy!
Tony
Code:
<SCRIPT LANGUAGE='JAVASCRIPT'>
var Img=new Image;
Img.src='[URL unfurl="true"]http://myserver.com/images/mypicture.jpg';[/URL]
var iWidth=Img.width;
var iHeight=Img.height;
</SCRIPT>
<SCRIPT LANGUAGE='JAVASCRIPT'>
document.write('<IMG SRC=[URL unfurl="true"]http://myserver.com/images/mypicture.jpg[/URL] WIDTH='+iWidth+' HEIGHT='+iHeight+' BORDER=0 ALT="My picture" ALIGN=RIGHT>');</SCRIPT>
The problem I am having is this...
If I generate a page and then view it and decide the image is the wrong shape then I may well go into Photoshop and crop the image and reupload it. When I go back into the browser and view the page, the image is updated but is keeping the dimensions of its previous version.
How can I get the dimensions of the image to be redetected from fresh every time??
Please help this is driving me crazy!
Tony
