Auto Image Orientation

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Get Involved
User avatar
AmigoJack
Registered User
Posts: 6120
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン

Re: Auto Image Orientation

Post by AmigoJack »

That solution is quick+dirty itself:
  1. ini_set() must be considered to fail.
  2. JPEGs are recompressed (which effectively decreases quality) albeit lossless rotation can be done.
  3. JPEG filename extensions jpe and jfif are not considered.
  4. PNGs with alpha channels will be deranged.
  5. TIFFs are not considered.
  6. BMPs are not considered.
  7. Animated GIFs will be lost and if you're lucky the first frame survives.
  8. All metadata (Exif, IPTC, XMP, JPEG/GIF comments, etc...) is lost, not only that one Exif value for the orientation.
  9. If by design always saving as JPEG potential transparency (PNG, GIF, BMP, TIFF) and animation (GIF) will always be lost.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
olsserik
Registered User
Posts: 155
Joined: Tue Aug 21, 2007 6:18 am

Re: Auto Image Orientation

Post by olsserik »

Hi,
I can not get this snippet to work. I´m on 3.0.12 and wonder if someone tried this snippet with this version?
I´ve tried with an untouched functions_upload.php and made all edits. Still nothing happens, no rotate where there should be and not even resizing (The original i uploaded).

Someone that can give me some clues?
Mike Ratledge
Registered User
Posts: 5
Joined: Mon Mar 03, 2014 3:34 am

Re: Auto Image Orientation

Post by Mike Ratledge »

Was this ever implemented in the code base?

I came looking for a solution to the problem and found this admittedly ancient thread.

The site I just inherited uses 3.0.12, and I want to know if 3.0.14 fixes the problem.
User avatar
Brf
Support Team Member
Support Team Member
Posts: 53523
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}

Re: Auto Image Orientation

Post by Brf »

What problem? Teaching users to hold their phones properly is beyond the scope of this board.
Mike Ratledge
Registered User
Posts: 5
Joined: Mon Mar 03, 2014 3:34 am

Re: Auto Image Orientation

Post by Mike Ratledge »

Brf wrote:What problem? Teaching users to hold their phones properly is beyond the scope of this board.
Seriously? It has nothing to do with holding the phone correctly, because it is smart enough to read and respond to the EXIF data. The user never knows that there is a problem, because for them, there isn't - until phpBB gets involved.

No matter what way you hold the phone or tablet, it will display the file correctly - by using orientation code.

phpBB 3.0.12 is not aware of the orientation stored in the files.
User avatar
AmigoJack
Registered User
Posts: 6120
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン

Re: Auto Image Orientation

Post by AmigoJack »

Mike Ratledge wrote:orientation stored in the files
Uhm, why doesn't your internet browser in the first place interpret the picture's orientations and auto rotate them? It could be helped by examining pictures for EXIF data and then apply CSS to its presentation. Everything else would result in altering the pictures (instead of its presentation only).
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
Mike Ratledge
Registered User
Posts: 5
Joined: Mon Mar 03, 2014 3:34 am

Re: Auto Image Orientation

Post by Mike Ratledge »

AmigoJack wrote:
Mike Ratledge wrote:orientation stored in the files
Uhm, why doesn't your internet browser in the first place interpret the picture's orientations and auto rotate them? It could be helped by examining pictures for EXIF data and then apply CSS to its presentation. Everything else would result in altering the pictures (instead of its presentation only).
The browser does show the picture correctly - even if phpBB is showing it wrong, a when you touch it or click on it, the browser displays it correctly.

Its phpBB that stores it incorrectly to begin with.

That's why the code needs to handle it on upload and not make it sever side.
User avatar
AmigoJack
Registered User
Posts: 6120
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン

Re: Auto Image Orientation

Post by AmigoJack »

Mike Ratledge wrote:the code needs to handle it on upload and not make it sever side
You can't mean what you said, because then the internet browser would alter the picture already. phpBB can't force clients to do something - it can only perform server-side. But that would alter the picture, instead of just displaying it "correctly".
Mike Ratledge wrote:The browser does show the picture correctly - even if phpBB is showing it wrong, a when you touch it or click on it, the browser displays it correctly.
Do you mix up thumbnails with originals? Because then phpBB's only lack is to add EXIF data for orientation to the thumbnail aswell.

Can you come up with examples? Also which internet browsers in which versions you experienced.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
Mike Ratledge
Registered User
Posts: 5
Joined: Mon Mar 03, 2014 3:34 am

Re: Auto Image Orientation

Post by Mike Ratledge »

AmigoJack wrote:
Mike Ratledge wrote:the code needs to handle it on upload and not make it sever side
You can't mean what you said, because then the internet browser would alter the picture already. phpBB can't force clients to do something - it can only perform server-side. But that would alter the picture, instead of just displaying it "correctly".
Mike Ratledge wrote:The browser does show the picture correctly - even if phpBB is showing it wrong, a when you touch it or click on it, the browser displays it correctly.
Do you mix up thumbnails with originals? Because then phpBB's only lack is to add EXIF data for orientation to the thumbnail aswell.

Can you come up with examples? Also which internet browsers in which versions you experienced.
When a browser receives HTML if acts differently than it does when it receives a JPG file. The HTML sends context, CSS, etc and the browser doesn't try to fix an embedded image, it simply displays it.

On the other hand, if it gets a JPG file, it looks at the EXIF data to se which way is up in reality regardless of how it was stored.

For example, my Galaxy S3, S4 & S5 or her iPhone all show the graphic "wrong" when embedded in HTML, but correctly if JPG, and it doesn't matter what browser or graphics program is displaying it. They all show the files correctly raw, but as told to in HTML.

Same thing happens on my a Windows or Linux laptops, exactly the same. Again, Firefox, Internet Exploder, Chrome, native Android, iPhone browser - all show them exactly the same.
User avatar
AmigoJack
Registered User
Posts: 6120
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン

Re: Auto Image Orientation

Post by AmigoJack »

Mike Ratledge wrote:For example, my Galaxy S3, S4 & S5 or her iPhone all show the graphic "wrong" when embedded in HTML
Then my knowledge yet isn't outdated. But you have to admit: if internet browsers are able to read each picture's EXIF data to recognize an orientation tag then why is there no setting to rotate them all?

Yes, I understand that internet browsers interpret data differently and basically they all have to magically make the right choice of instantly interpreting the download (*ML, JPEG/PNG...) or just displaying it (TXT, CSS...) or doing what the average user understands and expects as "download" (EXE, ZIP...).

But if you experience everything as I expect it then I fail to see why specifically phpBB has an issue: opening the original picture should auto rotate it by the client aswell. That's why I asked for distinguishing between thumbnails and originals.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28

Return to “[3.0.x] MOD Requests”