-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Editor: image is not rotated correctly in post editor #313
Comments
Closed https://github.com/Automattic/wp-desktop/issues/147 as a duplicate, raised by @ryanmarkel Site I'm testing on is ryanmarkel.com (it's hosted on VIP Go as a test site). App version is 1.3. When uploading images that were taken with my iPhone 6+, the rotation data is not respected when viewing the post within the post editor: The Media Library view displays the image with proper rotation: |
@gwwar do think think this one is in your wheelhouse? |
There's also some related background in 8870-gh-calypso-pre-oss |
I tested this and confirmed the incorrect behavior in editor with Jetpack sites. Until this is fixed in core, I think it makes sense to use Photon for editor previews if a blog is using Photon for posts. Editor preview images uses urls like the following:
While the correct orientation on the post uses urls like:
|
This would have the added benefit (if we use the |
I did a bit of research on this being fixed in core. The most relevant thread is this one: TLDR:
There is no apparent action to fix that. Older ticket: For me, it seems that counting on this being fixed in core cant keep up with our timeline. That would "kinda" fix a bug in core in jetpack instead of core itself and that seems to me like trouble down the road - do we generally even consider it? |
We do consider it, carefully commenting the code in question so it can be removed later. |
@azaozz Can you take a look also? |
Currently core still depends on the user to rotate the images by hand after uploading. This is (finally) set for fixing in 4.7. The best patch for now is https://core.trac.wordpress.org/attachment/ticket/14459/14459.2.diff. It depends on GD removing the EXIF data from rotated JPEGs. IMagick can write EXIF, so the patch resets/removes "Orientation" after rotating. The plugin mentioned above is not that reliable. It "hacks" the image files directly (binary) and tries to remove the EXIF orientation. Note the inline comment there:
|
@azaozz Do you think we should wait until we merge 4.7 to WP.com for this? Or patch / hack it now with a comment? |
@lancewillett from the latest discussion in the core-media Slack channel, this is probably not going to be in 4.7. The concern is that on shared hosting it will make some uploads fail because it takes too much memory and processor power to rotate a large image, and that when only GD is available on the server, all of the EXIF data will be stripped from the rotated image. Looking at this ticket again: it is not really a Calypso problem. I'm thinking we can probably implement something like https://core.trac.wordpress.org/attachment/ticket/14459/14459.2.diff as a plugin and use it when uploading from Calypso. An elegant solution would be to detect this before uploading the image and rotate it and fix the EXIF orientation from JS. This is quite possible in newer browsers, but not sure if it will work for phones, etc. (same problem, high RAM and CPU requirements). |
CC @aduth for a 2nd opinion on what you think would be the most elegant solution. |
The JS solution mentioned by @azaozz could use an approach similar to that in #5020, an unfinished pull request which sought to fix the related #318. For image rotation after the image uploads, we could use Photon to display the image in the editor, which I believe would show with the correct rotation. See original comment for more details where I mentioned this. We could also/alternatively apply the CSS |
@aduth How much time do you think it would take to use Photon in the editor like you mention? |
@apeatling Might not be too much work. We could probably hook into the plugin we created to artificially downsize images without affecting the saved 11963-gh-calypso-pre-oss |
Cool, that seems pretty doable. Does anyone on IO have some time to knock that one off? It's one of the top three highest priority issues for Calypso posted by Flow Patrol. It'd be great to close it out. |
@apeatling I'll try to take a stab at it, hopefully by end of week, else in the new year. |
Apologies for the delay on revisiting this. Shortly after my previous message, I made an attempt to put together a working branch to solve rotation issues based on my thinking that simply passing all images through Photon would be a suitable solution. I encountered a couple issues with this in our resizing utility not being generic enough (related changes in #10264). #11239 is an attempt at fixing rotation. There are a number of caveats there, including issues with solving rotation for featured image. #11239 only solves the simple case of rotated images in post editor content (not flipped). |
From the original issue text, this is now fixed for:
But not:
See #11239 for complications around rotation for featured images, specifically around supporting custom thumbnail sizes. |
#bug-scrub Tested and confirmed that inserting images with rotation EXIF metadata into Jetpack sites are now correctly rotated in the post body but are still incorrectly rotated in the featured image area in the Calypso editor: Video: 1 min
|
Opened a separate issue in #13145 to address the featured images and closing this issue as resolved. |
From @jeherve
Steps to reproduce:
1. Click on Insert. 2. Publish post.
Here is how the image looks like in the editor:
The problem seems similar for the Featured Image view:
From @aduth
From @sararosso
The text was updated successfully, but these errors were encountered: