javascript - How to get image size dyamically w/ mutliple instances? -
i using filereader populate images.
// i.e. .... e.target.result
if set image element source this:
pic_upload_area.src = some_image;
i can dimensions this:
width = pic_upload_area.clientwidth;
and things work fine. if reset new image this:
pic_upload_area.src = ''; pic_upload_area.src = new_image;
and 1 time 1 time again image this:
width = pic_upload_area.clientwidth;
i find still has old image width, , new image has been malformed fit old image's dimensions.
i find unusual works on first attempt. how can clientwidth
update when update .src
attribute of image?
the easiest way delete , recreate pic_upload_area
. 1 time dimensions set, new image src
conform old dimensions.
javascript
No comments:
Post a Comment