Images rotated ??

Get help with installation and running phpBB 3.3.x here. Please do not post bug reports, feature requests, or extension related questions here.
65Corsa
Registered User
Posts: 35
Joined: Thu Sep 08, 2022 12:02 am

Images rotated ??

Post by 65Corsa »

How can I prevent images which get posted from being rotated in the message ? If I click on the image it displays correctly. See example below.

Thanks -

Alec
Screen Shot 2024-07-29 at 8.00.09 PM.png
You do not have the required permissions to view the files attached to this post.
Last edited by Mick on Fri Aug 02, 2024 6:16 am, edited 1 time in total.
Reason: Solved.
User avatar
janus_zonstraal
Registered User
Posts: 6619
Joined: Sat Aug 30, 2014 1:30 pm

Re: Images rotated ??

Post by janus_zonstraal »

Please fill out the Support Request Template and post it back here to enable us to assist you better.
Sorry! My English is bat ;) !!!
65Corsa
Registered User
Posts: 35
Joined: Thu Sep 08, 2022 12:02 am

Re: Images rotated ??

Post by 65Corsa »

Support Request Template
What version of phpBB are you using? phpBB 3.3.11
What is your board's URL? https://corvaircenter.com/forum/viewforum.php?f=11
Who do you host your board with? InMotion
How did you install your board? I used the download package from phpBB.com
What is the most recent action performed on your board? Update from a previous version of phpBB3
Is registration required to reproduce this issue? Yes
Do you have any MODs installed? Yes
Do you have any extensions installed? Yes
What version of phpBB3 did you update from? phpBB 3.3.10
What MODs do you have installed? phpbb_mediaembed_2.0.2
rightheaderimage_3_2_2
What extensions do you have installed? headerlink_3_2_2
largefont
chgposttime
What styles do you currently have installed? ps4_pro_2.1.11
What language(s) is your board currently using? English
Which database type/version are you using? MySQL 4
What is your level of experience? New to PHP but not phpBB
What username can be used to view this issue? ACTestUser
What password can be used to view this issue? PM me for passsword
What actions did you take (updating your board; installing a MOD, style or extension; etc.) prior to this problem becoming noticeable? This has always been a problem
Please describe your problem. If I attach an image that is portrait format - height greater then width, the image is resized and gets displayed rotated left 90*. If I click on the rotated image, it expands and displays correctly.
Generated by SRT Generator
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 6711
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.

Re: Images rotated ??

Post by thecoalman »

There is no way to fix this I'm aware of without editing plupload which is third party software.

https://github.com/phpbb/phpbb/pull/6131
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
65Corsa
Registered User
Posts: 35
Joined: Thu Sep 08, 2022 12:02 am

Re: Images rotated ??

Post by 65Corsa »

OK, Thanks !!! I had a feeling that would be the case...

Alec
SQLnovice
Registered User
Posts: 177
Joined: Thu Oct 10, 2019 5:03 am

Re: Images rotated ??

Post by SQLnovice »

We see this a lot more on our forum too. Thus far, it's always associated with smartphone images taken in the portrait orientation that get rotated 90 degrees. In portrait mode the orientation seems to be 9:16 instead of 16:9 (1920 x 1080 widescreen) and I think the forum or our Lightbox extension reorients it to 16:9 which then flips the image sideways.

I've added a forum image How-To asking users to take photographs in landscape 16:9 mode (see below), but it's difficult to force them to read or do anything.Image

Our forum is small, so I end up using Windows picture and fax viewer or Photoshop to rotate and save the images, before replacing them on the forum. Almost always portrait pictures are of the incorrect orientation to begin with. The image should have been taken in landscape widescreen, but I think kids these days see people on TV doing it that way, so they copy it. Cropping the image tops and bottoms off into 4:3 orientation works well too in many cases, so the image displays in the best possible clarity for both smartphone and PC users.
Image
User avatar
Gumboots
Registered User
Posts: 850
Joined: Fri Oct 11, 2019 1:59 am

Re: Images rotated ??

Post by Gumboots »

The issue is caused by photos taken on phones including a flag in the header which says "This way up". This ensures the photo will display with the correct orientation regardless of whether the phone is in portrait or landscape mode. PC's (and forum software) don't read this flag by default, so some images get displayed with the wrong orientation.

It should be possible to write an extension to deal with this automatically. In fact I'm surprised that nobody has done it yet. I know of open source examples for other software (MIT license, IIRC). A project I was involved with years ago even included it in core.

If anyone wants to have a serious crack at writing such an extension (or even adding it to core) I'm happy to hook them up with relevant examples.
🇺🇦 Слава Україні! 🇺🇦 Героям слава! 🇺🇦
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 6711
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.

Re: Images rotated ??

Post by thecoalman »

Gumboots wrote: Tue Aug 13, 2024 10:19 pm PC's (and forum software) don't read this flag by default, so some images get displayed with the wrong orientation.
This is supported by just about everything including browsers. What happens is the orientation is removed or set incorrectly during manipulation by plupload or with thumbnail creation server side. The browser no longer knows which end is up. It's only correct if they took the image using landscape and the phone is not "upside down".

The fix I linked to above should fix it, you may ls also need to change the value for "strip meta data".

Years ago you could just add preserve_headers: false around line 268 in /phpbb/plupload/plupload.php This is now added with the remove meta data option in the ACP. What happens with that flag is pluplaod will rotate the image to correct orientation before stripping the EXIF data preventing any issues down the line with thumbnail creation.

For whatever reason this by itself stopped working a few years back, I believe it has something to do with changed browser behaviors. The fix I linked to above should resolve that issue. As noted in the linked page it's third party software and will not be fixed by phpBB. That's not to say it won't be fixed some other way down the line.

-----------------

If you want to preserve the EXIF data it should only effect thumbnails. There is extension for using Imagick for 3.2 that correctly handles the orientation for thumbs but I don't know if it works for 3.3, additionally you need Imagick installed. Read this first before even trying it.


https://www.phpbb.com/customise/db/exte ... r/faq/2791
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
SQLnovice
Registered User
Posts: 177
Joined: Thu Oct 10, 2019 5:03 am

Re: Images rotated ??

Post by SQLnovice »

thecoalman wrote: Wed Jul 31, 2024 10:46 pm There is no way to fix this I'm aware of without editing plupload which is third party software.

https://github.com/phpbb/phpbb/pull/6131
So what you're saying is that this potential fix is written to help future PHP extension coders or ones who know how to modify plupload, whatever that is. It's not written in a way for your typical novice PHPBB site administrator, like myself, to take advantage of.
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 6711
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.

Re: Images rotated ??

Post by thecoalman »

If you are not comfortable making the changes then don't, or least do it on testing forum. Anything like this should always be tested first.

What I can tell you with certainty is that it's the only way I'm aware of to fix this issue.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
SQLnovice
Registered User
Posts: 177
Joined: Thu Oct 10, 2019 5:03 am

Re: Images rotated ??

Post by SQLnovice »

I think most of us can make changes to our forum's PHP files via copy and paste, like updating the header logo and such, but will never actually truly understand the code we pasted in or how to debug it if there's a problem. Thus, it's what this forum is designed to address help to.

Whereas, then there are those who authored the PHP code, the code writers who wrote the forum code and know how to create extensions for forum code, on top of the professional knowledge to debug such code.

See the difference? Most of us would feel comfortable making changes to our forums code via copy and paste of what someone else has given us a guide to follow, but would be lost with something like this fix, that appears to be tailored, in white paper format, to PHP code authors who would understand how to write and debug PHP code to make it work.

It is my interpretation of the linked fix that this is the latter, a fix for those who have the ability to author and debug hundreds or thousands of lines of PHP code and therefore probably not something that most site administrators would even have the knowledge to understand, let alone feel comfortable making changes with.
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 6711
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.

Re: Images rotated ??

Post by thecoalman »

If you switch to the files changed tab it gives you the diffs. Lines with - are removed, lines with plus are added. Make sure you are not copying the + or minus.

I'm not a programmer either but modifying phpBB starting around 20 years ago is where I got started. Back then you didn;t have extensions, instead you did it line by line with files simialr to diff files.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison
SQLnovice
Registered User
Posts: 177
Joined: Thu Oct 10, 2019 5:03 am

Re: Images rotated ??

Post by SQLnovice »

Oh. :lol: So change
phpBB/assets/plupload/plupload.full.min.js
phpBB/styles/prosilver/template/plupload.html

Glad you mentioned the + and - thing. I wouldn't have otherwise known what they meant by including the authors including those characters. The color background in red for minus and green for plus helps distinguish the changes too.

I could give this a try. Same routine. Make backups of the original files, modify the working files, and test. Thank you for the helpful nudge! 8-)

Holy moly, :shock: :o but don't ask me to debug it.

Return to “[3.3.x] Support Forum”