But it was not resolved on July 10, as far as I can tell.
If a user has uploaded a photo and sees that the rotation is wrong, is there a line of code, or better, some menu item they can hit when they edit the post to rotate it the way it should be?
Sorry if this is a dumb question, but I’m flummoxed.
So, for example, if I edit a user’s post as below, is there something I can type or do to make the picture rotate?
[the example above actually has a picture that’s correct, but it was an easy way to show you the kind of code I want to help people edit]
Unfortunately there isn’t – if the image is rotated “incorrectly” when taken by a smartphone, it will retain that “incorrect” rotation when uploaded here.
(The bug linked was about image metadata for orientation, where the rendering platform / OS would take that metadata into account when displaying the image.)
There is no manual rotation of images supported in Discourse at the current time.
Have any image-rotation code changes been made recently on the hosted offering from discourse.org? Mine is running Discourse 1.8.8, which github says released 12 days ago. I don’t know when it made its way to my hosted forum.
Basically, posters who have submitted hundreds of images in the past recently started complaining that their landscape photos (including some that they’ve posted fine in the past) now appear sideways when added to posts. Someone reported this happening from an iOS device, and it seems odd to me that an iOS phone (absent an OS update, which has not happened) would spontaneously stop tagging photos with orientation info that Discourse can use. I’m concerned that Discourse is handling these images differently from how it did in the past.
Is anyone else seeing this?
Based on Mobile image upload turns sideways, this sounds like a bit of a mess, and I’m afraid a recent attempt to fix a problem may have made it worse (at least for me). I cannot reproduce this on my older Android phone, but it sounds like each camera device may tag or process images differently.
I’ve run across some photo hosting players that do handle this issue. It is possible, but someone would have to take the time to write a plugin or implement the functionality into an official Discourse release. I’m still learning my way around Discourse development, but for a future, more educated me, or someone else interested in trying to come up with something, I may have found something to look at for inspiration.
This article explains the issue and points to jhead, a public domain EXIF manipulation tool that runs on a command line. My understanding is that most of the problems with undesirable rotation stem from the rotation tag in a JPEG’s EXIF header There’s an option listed in the documentation that looks like it does the trick:
-autorot Using the ‘Orientation’ tag of the Exif header, rotate the image so that it is upright. The program ‘jpegtran’ is used to perform the rotation. This program is present in most Linux distributions. For windows, you need to get a copy of it. After rotation, the orientation tag of the Exif header is set to ‘1’ (normal orientation). The Exif thumbnail is also rotated. Other fields of the Exif header, including dimensions are untouched, but the JPEG height/width are adjusted.
This feature is especially useful with newer digital cameras, which set the orientation field in the Exif header automatically using a built in orientation sensor in the camera.
The stripping of EXIF info that happens upon uploading an image on Discourse may be the culprit. I looked at the EXIF data on one of the photos @codinghorror provided and there is no orientation tag. I think modern browsers might depend on that. I’m not certain this is the case, but that’s another area to check. It might just be a matter of retaining that tag.
These are on iOS devices of our forum users, so I do not have one handy. But they do say that photos uploaded in the same fashion a week or two ago had the proper orientation. There are multiple folks reporting this, so I don’t think the issue is that an errant phone lost its ability to know which way is up.
I have requested an original image, and I’ll share its information here when and if I get it.
On my machine, it shows up sideways, and the orientation in the EXIF data is “Horizontal (normal).” Thus it seems like Discourse is handling this image appropriately. I am not sure what sort of iOS magic makes the image appear properly on the end-user’s phone. Conspiracy theorists might suggest that Apple does this intentionally to punish those who data export their images outage of the iCloud world.
We have people snapping photos directly from within Discourse. Several extra steps would be involved in telling customers to take a photo, edit it, save the edited version, and then add that to a Discourse post. Simply telling people they’re “empowered” because anyone can rotate an image does not lead to a great customer experience, and it sounds like the image “looks” fine on their phone, so I’m not sure exactly what I’d tell them to do. Ultimately, if a process is a pain, people won’t do it, and I (the one who pays for Discourse) ends up with lesser user community as a result. If I allow images in my forum, I generally want it to be easy for people to place them there.
I gather that image rotation is a fairly common challenge on forums, especially in this modern, phone-filled world. I agree with @Seth_Godin that a rotation button would be an easy fix, allowing even the most simple-minded of end users to fix any rotation issues on their own without exiting the forum software. I’d obviously prefer that there be some magical feature that “fixes” this image situation automatically, but I’m not optimistic that is possible.
She also put it on Instagram, and it displays properly there, so maybe the iOS Instagram app has some way of divining the orientation and then re-processing the image (it’s been at least resized) so that it’s in portrait dimensions (I don’t see rotation instructions in the EXIF info in this image on Instagram’s CDN, although it kept/added a lot of EXIF data):
@djdavies75 You’re hosted with Communiteq (formerly DiscourseHosting). We keep our customers on the stable branch (1.8) where possible. Since you’re on the Business plan, we can upgrade you to the tests-passed build (1.9.x) which would probably solve this issue. Please contact our support desk if you would like to do this.