0
我正在尋找一種方法來查找傳入圖像的尺寸。 當我記錄高度和寬度時,它們都返回0。如何獲取存儲在JavaScript對象內的圖像的寬度和高度?
function GamePiece(imageName){
this.image = new Image();
this.image.src = imageName;
this.width = this.image.width;
this.height = this.image.height;
}