Is there a way to manually rotate an image

I see this thread:

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?

49

[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]

4 Likes

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.

1 Like

thanks for the quick and definitive answer. Almost as good as a fix!

1 Like

Here are 4 quick pics I took with my phone, in all four orientations.

2 Likes

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.

1 Like

Do you have images that exhibits this issue? Without examples it’s hard to see what’s going on.

Yes, take a look at the images here:

The images are stored on Amazon S3 and served from there, for whatever that’s worth.

Any chances you could link to the original images stored somewhere else other than Discourse?

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.

1 Like

as a tech-friendly but ultimately naive user, my best UI case would be a simple button that lets me rotate a picture if it looks wrong.

I think it’s frustrating for a poster to be forced to look at a photo that’s obviously wrong. It feels sloppy and makes the user feel powerless.

Just as users can change bold or italic, changing rotation feels like something a friendly computer can do for us.

7 Likes

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.

2 Likes

They aren’t powerless though — every phone has a photos app that can rotate prior to upload.

In my testing (already posted above) the uploading was consistent with the orientation of the device at the time the picture was taken.

1 Like

One of the original images is here:

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.

1 Like

A bit more follow-up here. The image is oriented properly when the user views it in her iOS Photos app. See the screenshot below:

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):

Instagram: https://instagram.forf1-1.fna.fbcdn.net/t51.2885-15/e15/fr/p1080x1080/22351620_792264904313741_6889844042113220608_n.jpg

1 Like

Here’s the image from instagram’s CDN

@zogstrip Note that this is about a forum running on Discourse 1.8.8 , and the changes in https://github.com/discourse/discourse/commit/1c12dd529fad8888f2334962adc0736fd3756172 have not been backported to 1.8.

@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.

1 Like

I guess I should have checked that version included my fix. Thanks for the heads up :+1:

Any chance of being able to backport it into 1.8 ?

@michaeld What is the rough timeline for 1.9.x being declared stable and getting rolled out to Communiteq (formerly DiscourseHosting)?

The release is scheduled for november according to this post, so that can be anything between 3 and 7 weeks from now.

We at Communiteq (formerly DiscourseHosting) will roll it out within a few days after it’s released.

3 Likes