2011-07-23 100 views
0

如何在上传时通过jQuery获取图像的大小,高度和宽度?获取图像的大小,高度和宽度?

+0

问题是? – ChristopheCVB

+3

这个问题不是很清楚。包括一个小代码示例和/或澄清问题。 – jfriend00

+0

我不确定你是用“用jQuery上传它”来暗示你的意思,但我的猜测是你会在这里找到你的答案http://goo.gl/m1J8V – Jed

回答

2

,如果你使用jquery uploadify插件,那么你可以找到其中任何一个文件的大小下面的方法

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

OR,

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

,并使用

$('img').css('width'); 
$('img').css('height'); 
+0

不,我不使用。我如何获得大小? –

0
$("#imgId").css('width') 
$("#imgId").css('height') 
+0

我如何获得大小? –