Get Imagesize in jQuery
Posted
by Jean
on Stack Overflow
See other posts from Stack Overflow
or by Jean
Published on 2010-04-28T09:32:07Z
Indexed on
2010/04/28
9:43 UTC
Read the original article
Hit count: 374
jQuery
|JavaScript
Hello,
I want to get the imagesize in jquery, I have this code. It works to the point of
alert (v);
I wonder what is wrong with the rest when v actually contains a value.
var v = $('#xxx input').val();
alert (v);
var newImg = new Image();
newImg.src = v;
var height = newImg.height;
var width = newImg.width;
alert ('The image size is '+width+'*'+height);
Thanks Jean
© Stack Overflow or respective owner