blueimp/JavaScript-Load-Image

Squashed image in iOS Safari

gippea opened this issue · 2 comments

Hi,

I'm using this library for a project to orientate the images correctly. So far so good.

But the canvas created in iPhone 6 (iOS Safari) is squashed to fit the horizontal bounds in portrait mode.

        const image = await loadImage(
          selectedMedia?.user_media,
          function (img, data) {
            alert("Original image width: " + data.originalWidth);
            alert("Original image height: " + data.originalHeight);

            alert(img.width + " - " + img.height);

            console.dir(img);

            setMediaContent(mediaRef.current);

            console.log("orientation", orientation);

            if (orientation === "portrait") {
              mediaRef.current.style.setProperty(
                "--media-captured-align-items",
                "center"
              );
            } else {
              mediaRef.current.style.setProperty(
                "--media-captured-align-items",
                "flex-start"
              );
            }

            mediaRef.current.appendChild(img);
          },
          {
            orientation: 1,
            maxWidth:
              orientation === "portrait"
                ? window.innerWidth
                : window.innerHeight,
          }
        );

Hi @gippea,

thanks for your report.
Unfortunately your code snippet is not sufficient to identify the issue.
Could you provide more information please, including the following:

  • iOS version used
  • Sample image provided via URL

Also, could you confirm if you can reproduce the issue on the demo?

Closing as non-reproducible.