获取图片上传后的宽度高度的方法

要获取图片上传后的宽度高度,可以使用

img.onload=function(){
var baseWidth = this.width;
$("#"+id).width(baseWidth);
}
jq写法
$('img').load(function(){
  var baseWidth = this.width;
  $("#"+id).width(baseWidth);

})
posted @ 2016-05-03 08:55  施主放过小僧吧  阅读(252)  评论(0编辑  收藏  举报