Skip to content

Exif Orientation leads to wrong scaling #14

Description

@helmut8080

Hi,
first I like your script. Very well done!
I have in my project

img {
	image-orientation: from-image;
}

With this enabled images are wrongly scaled when the image needs to be rotated because of the orientation. As I did not find a quick solution to read the exif information I did it quick and dirty change in row 213.

if (Math.round(img.naturalHeight/img.naturalWidth * 100) == Math.round(img.width/img.height * 100)) {
    	that.imgHeight = img.naturalWidth || img.width;
        that.imgWidth = img.naturalHeight || img.height;
    }
    else {
	    that.imgWidth = img.naturalWidth || img.width;
	    that.imgHeight = img.naturalHeight || img.height;
    }

And it works (at least in my cases) Would be great if you have a cleaner solution.
Thanks again.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions