Results 1 to 1 of 1
Dec 23, 2006, 14:24 #1
- Join Date
- Feb 2004
- Hampshire, UK
- 0 Post(s)
- 0 Thread(s)
Stale image properties after image reload
When the user clicks the upload button the image is uploaded by the connection manager and the uploadResponse callback invokes my response function. If the uploaded image has simply been replaced, this response function causes the image to be reloaded by reassigning it's src property to the same url as before but with a '?' + now.getTime() appended to ensure the browsers cached version is replaced.
So far so good, and I am gratified by seeing the image updated in place. The next step is where I am seeing some behavior I didn't expect. The remaining functions allow the uploaded image to be cropped and involve using the images offsetLeft, offsetTop, offsetHeight and offsetWidth to define a boundary inside which a 500px x 500px translucent DHTML div can be dragged around as a cropping window.
What I think I am seeing is that although the assignment to the src property causes the image to be reloaded, it doesn't seem to result in the offsetLeft, offsetTop, offsetHeight and offsetWidth properties to be updated to match. Can anyone tell me if this is what would be expected? If so, is there any way in which I can also force them to be refreshed?
I have only tried this under Firefox so far as my code is peppered with console.log messages which I don't want to remove yet and these cause IE to barf (wish I done something like dbug - a console.log (firebug) wrapper).
Last edited by nickweavers; Dec 23, 2006 at 16:08.