Loading image with correct path and format error

 assetManager.loadRemote<ImageAsset>(resourceUrl, (err, imageAsset) => {
          if (err) {
            console.debug(err, resourceUrl);
            return;
          }
          this._resource!.preload = true;
          if (imageAsset instanceof ImageAsset) {
            const spriteFrame = new SpriteFrame();
            const texture = new Texture2D();
            texture.image = imageAsset;
            spriteFrame.texture = texture;
            this._resource!.spriteFrame = spriteFrame;
          }
          this.imageZoomViewer.spriteFrame = this._resource?.spriteFrame;
        });

I used loadRemote to load the image even though the image path is correct and I tried downloading a png image but when using loadRemote callback it returns an Assets not an ImageAsset, what is wrong?

Hi @tuyenbeat,

Is the place you are requesting the image from definitely responding with the correct MIME type? If not, then I guess cocos may not recognise it as an ImageAsset!

If you inspect your browsers developer tools can you see the request for the image? For a png the mime type header should be ‘image/png’…