Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exif Orientation leads to wrong scaling #14

Open
helmut8080 opened this issue Sep 4, 2017 · 0 comments
Open

Exif Orientation leads to wrong scaling #14

helmut8080 opened this issue Sep 4, 2017 · 0 comments

Comments

@helmut8080
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant