0

How can I get the size, height and width of an image in when upload it with jQuery?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Mehd S
  • 583
  • 2
  • 10
  • 21
  • 3
    This question is not very clear. Include a small code example and/or clarify the question. – jfriend00 Jul 23 '11 at 16:13
  • I'm not sure what you are implying by "..uploade it with jQuery", but my guess is that you will find your answer here http://goo.gl/m1J8V – Jed Jul 23 '11 at 16:15
  • possible duplicate of [Determine original size of image cross browser?](http://stackoverflow.com/questions/1944280/determine-original-size-of-image-cross-browser) – Brock Adams Jul 23 '11 at 16:24

2 Answers2

2

if you use jquery uploadify plugin then you can find the file size by any one of these following method

'onSelect': function(event, ID, fileObj) {
    console.log(fileObj.size);
}

OR,

'onComplete': function(event, ID, fileObj, response, data) {
    console.log(fileObj.size);
}

and use

$('img').css('width');
$('img').css('height');
thecodeparadox
  • 86,271
  • 21
  • 138
  • 164
0
$("#imgId").css('width')
$("#imgId").css('height')
Royi Namir
  • 144,742
  • 138
  • 468
  • 792