0
我正在寻找一种方法来查找传入图像的尺寸。 当我记录高度和宽度时,它们都返回0。如何获取存储在JavaScript对象内的图像的宽度和高度?
function GamePiece(imageName){
this.image = new Image();
this.image.src = imageName;
this.width = this.image.width;
this.height = this.image.height;
}