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

Portrait Pictures shown streched to fit screen #67

Open
itadminatitgroup opened this issue Aug 27, 2019 · 3 comments
Open

Portrait Pictures shown streched to fit screen #67

itadminatitgroup opened this issue Aug 27, 2019 · 3 comments
Assignees

Comments

@itadminatitgroup
Copy link

the preview in browser shows the picture in wrong format.
it is portrait, but it streches it to landscape.

try with this picture:
DSC_0247

@tofi86 tofi86 self-assigned this Sep 25, 2019
@tofi86
Copy link
Collaborator

tofi86 commented Sep 25, 2019

Funny thing: This happens here on GitHub as well, right? ;-)

The "problem" is, that your image has the "portrait orientation" set as an EXIF metadate:

Bildschirmfoto 2019-09-25 um 15 51 02

(sorry, german only, but you can read the marked entry as "Orientation: 6 (90° rotated counter-clockwise)"

And Redmine and other systems can't handle this metadate so they ignore it and present the image "as is", which means in landscape without the rotation.

On the other hand, the Windows image viewer, Mac OS Viewer and alike can handle this metadate and rotate the image properly. So they're making us think that "something is wrong with Redmine, Github, etc." but it isn't.

Normally, when rotating an image in those Desktop programs, the Orientation attribute is reset to 1 upon saving.
So I don't know why this isn't happening in your case. I assume the image is directly from the camera and hasn't been edited yet.

A similar question has been raised on StackOverflow: https://stackoverflow.com/questions/24658365/img-tag-displays-wrong-orientation

I could implement the CSS rule image-orientation: from-image; but CanIUse says it's not widely supported: https://caniuse.com/#search=image-orientation
From my observation, Firefox is doing this anyway, resulting in a stretched view of the image, but with correct orientation:

Bildschirmfoto 2019-09-25 um 16 27 27

While Chrome isn't implementing this rule, resulting in an non-rotated view which is what you call "wrong format":

Bildschirmfoto 2019-09-25 um 16 27 44

Testing and seeing this, I will add image-orientation: initial; to a further release in order to maintain the landscape view in Firefox to match the behaviour in other browsers and do not stretch and distort the image.

In the end, I'm stuck doing more because the lightbox library "fancybox" does not have any more options for this. I assume it's a bug how they retrieve the image size from source and I will open an issue at their bugtracker.

In the meantime I suggest you rotate and save the image in a desktop application and re-upload on your site. Sorry.

tofi86 added a commit that referenced this issue Sep 25, 2019
due to a possible bug in the fancybox library
tofi86 added a commit that referenced this issue Sep 25, 2019
due to a possible bug in the fancybox library
@tofi86
Copy link
Collaborator

tofi86 commented Sep 25, 2019

Testing and seeing this, I will add image-orientation: initial; to a further release in order to maintain the landscape view in Firefox to match the behaviour in other browsers and do not stretch and distort the image.

Done for Redmine 3.4 on branch redmine-3.4.

Done for Redmine 4.0 on branch master.

No new version has been released yet. Still looking for ways to read the EXIF meta data and find a workaround for fancybox.

@tofi86 tofi86 added this to the Next release milestone Sep 25, 2019
@tofi86
Copy link
Collaborator

tofi86 commented Sep 26, 2019

A similar fancybox issue got closed: fancyapps/fancybox#2293

So I guess this won't be implemented/fixed and I can'T do anything here at the moment...

@tofi86 tofi86 removed this from the Next release milestone Nov 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants