jQuery:如何获取外部图像的尺寸?

use*_*235 2 javascript jquery image dimensions

寻找获得外部图像尺寸(宽度和高度)的方法.
我已经使用prop()attr(),但他们不返回任何值.只是一个错误.

例:

<a href="pathtotheimage">some link</a>
Run Code Online (Sandbox Code Playgroud)

Sim*_*old 9

var imgSrc = "http://server.com/your/image/path/here.jpg"
var _width, _height;
$("<img/>").attr("src", imgSrc).load(function() {
    _width = this.width; 
    _height = this.height;
 });
Run Code Online (Sandbox Code Playgroud)