Image orientation in plupload, using EXIF

Do not post support requests, bug reports or feature requests. Discuss phpBB here. Non-phpBB related discussion goes in General Discussion!
Scam Warning
User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 3304
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: Image orientation in plupload, using EXIF

Post by thecoalman » Sun Nov 04, 2018 4:30 am

tojag wrote:
Sun Oct 28, 2018 9:57 pm
Is it possible that the image published from the iPad displays wrong, and the same image published from another system displays correctly? It seems impossible.
EXIF orientation can be quite confusing if not handled properly. For example suppose you were using editing software that doesn't support it. The image would be oriented wrong. You rotate the raw file data and save, the EXIF orientation is preserved . Loks fine in the editor but when you view it in something that does support it now it's flipped again. LOL... That's worse case because the orientation is no longer accurate.

How this applies here is as I just mentioned in previous post the thumbnails are not handled by plupload. The EXIF data is stripped when thumbnails are created so they will always have wrong orientation if they are oriented with EXIF.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”

Attributed - Thomas Edison

KYPREO
Registered User
Posts: 94
Joined: Fri Feb 02, 2018 9:56 am
Contact:

Re: Image orientation in plupload, using EXIF

Post by KYPREO » Tue Nov 06, 2018 2:49 am

thecoalman wrote:
Sun Nov 04, 2018 4:20 am
KYPREO wrote:
Sat Oct 27, 2018 11:15 am
But, the attachments don't render in post with the correct orientation. However, if you open the direct URL of the uploaded image in a new tab it is correctly oriented. The means the EXIF data is just being retained and properly interpreted by the browser, but not phpBB.
Plupload only handles the full size image it doesn't handle the thumbnail.
Thanks for the reply. I don't think that's it because I don't use thumbnails for attachments on my forum at all. The file size attachment is not being rendered with correct rotation within phpBB.
phpBB user since 2002
www.AusRotary.com

KYPREO
Registered User
Posts: 94
Joined: Fri Feb 02, 2018 9:56 am
Contact:

Re: Image orientation in plupload, using EXIF

Post by KYPREO » Fri Nov 09, 2018 12:50 pm

Well I just managed to fix it!

I implemented this change to /phpbb/plupload/plupload.php (around line 269):

From

Code: Select all

'resize: {width: %d, height: %d, quality: 85},',
to

Code: Select all

'resize: {width: %d, height: %d, quality: 85,preserve_headers: false},',
Previously this edit did nothing for me. Now, with the new version of plupload it works. Image is correctly orientated according to EXIF data and then the EXIF data is then stripped. 8-)

I know v12mike was able to get it working without this code change, but for me it was required. I will do some more testing, but all the test images and sample photos taken in landscape mode on my Samsung S9+ now display as they should.
phpBB user since 2002
www.AusRotary.com

benwtf
Registered User
Posts: 6
Joined: Mon Nov 05, 2018 10:52 pm

Re: Image orientation in plupload, using EXIF

Post by benwtf » Mon Dec 03, 2018 6:54 am

Testing with an image provided by a user who complained, I was able to use this extension with max dimensions set in attachments with no code modifications in 3.2.4.

Thank you!

EDIT: The extension here: viewtopic.php?f=456&t=2477256&p=15143616#p15143616
That's where I meant to post

Streamer76
Registered User
Posts: 58
Joined: Mon Dec 17, 2007 6:26 pm

Re: Image orientation in plupload, using EXIF

Post by Streamer76 » Thu Jan 17, 2019 6:23 pm

Phpbb 3.2.5 seems to have plupload 2.3.6 version about plupload.full.min.js but there's still the same problem wit the images.

I added to "preserve_headers: false" to /phpbb/plupload/plupload.php but does not help. Somehow this trick worked fine with 3.1.x but not for the 3.2.5, at least not my phone images (LG G6).

Cannot use ImageMagick extension because my host does not support it.

Any ideas? :?:

User avatar
canonknipser
Registered User
Posts: 2091
Joined: Thu Sep 08, 2011 4:16 am
Location: Germany
Name: Frank Jakobs
Contact:

Re: Image orientation in plupload, using EXIF

Post by canonknipser » Thu Jan 17, 2019 8:16 pm

Streamer76 wrote:
Thu Jan 17, 2019 6:23 pm
Any ideas?
Do it the old fashioned way: rotate (and maybe resize also) the image with a image manipulation program (gimp, photoshop, paint ...) or use jpegtran or a web service before uploading the images. I recommend it this way because rotating with plupload will only happen when the images needs to be resized. And the resizing with plupload is using a poor quality algorithm.
Greetings, Frank
phpbb.de support team member
English is not my native language - no support via PM or mail
New arrival - Extensions and scripts for phpBB

Streamer76
Registered User
Posts: 58
Joined: Mon Dec 17, 2007 6:26 pm

Re: Image orientation in plupload, using EXIF

Post by Streamer76 » Fri Jan 18, 2019 4:20 pm

canonknipser wrote:
Thu Jan 17, 2019 8:16 pm
Streamer76 wrote:
Thu Jan 17, 2019 6:23 pm
Any ideas?
Do it the old fashioned way: rotate (and maybe resize also) the image with a image manipulation program (gimp, photoshop, paint ...) or use jpegtran or a web service before uploading the images. I recommend it this way because rotating with plupload will only happen when the images needs to be resized. And the resizing with plupload is using a poor quality algorithm.
I can do that but I know that 99% users does not want to do that.

User avatar
canonknipser
Registered User
Posts: 2091
Joined: Thu Sep 08, 2011 4:16 am
Location: Germany
Name: Frank Jakobs
Contact:

Re: Image orientation in plupload, using EXIF

Post by canonknipser » Fri Jan 18, 2019 8:43 pm

Some small questions:
  • Is image resizing in effect on your board, which means do you have set maximum image dimensions?
  • Is image resizing in effect for the pictures you mentioned
    Streamer76 wrote:
    Thu Jan 17, 2019 6:23 pm
    at least not my phone images (LG G6).
    - are they bigger in dimension than those values set in acp?
  • Do you generate thumbnails?
  • Why does you host not support ImageMagick?
Greetings, Frank
phpbb.de support team member
English is not my native language - no support via PM or mail
New arrival - Extensions and scripts for phpBB

GentekPower
Registered User
Posts: 12
Joined: Wed Nov 21, 2018 2:13 am
Name: Chris
Contact:

Re: Image orientation in plupload, using EXIF

Post by GentekPower » Tue Jan 29, 2019 2:13 pm

I wanted to add some input about the same issues I was having and the fix that finally got them...

Same rotation issues for me. Most were 90 deg counterclockwise. I tried the new bit of code with no success and then also the new version of plupload with what seemed no success...

The trick was that I had to purge the cache on both the server, phhpbb, AND MY BROWSER... That's what really fixed it. I had not been clearing the cached files on my local browser, but continuing to test and it wasn't working. For now it seems to be working... Board is running 3.2.3
Owner - Gentek Power.
Generac generator troubleshooting & help forums. https://gentekpower.com/forums

Streamer76
Registered User
Posts: 58
Joined: Mon Dec 17, 2007 6:26 pm

Re: Image orientation in plupload, using EXIF

Post by Streamer76 » Sun Feb 10, 2019 3:57 pm

canonknipser wrote:
Fri Jan 18, 2019 8:43 pm
Some small questions:
  • Is image resizing in effect on your board, which means do you have set maximum image dimensions?
  • Is image resizing in effect for the pictures you mentioned
    Streamer76 wrote:
    Thu Jan 17, 2019 6:23 pm
    at least not my phone images (LG G6).
    - are they bigger in dimension than those values set in acp?
  • Do you generate thumbnails?
  • Why does you host not support ImageMagick?
Here is our board settings. I have no idea why my host does not support ImageMagick.
Attachments
phpbbimagesettings.png

Streamer76
Registered User
Posts: 58
Joined: Mon Dec 17, 2007 6:26 pm

Re: Image orientation in plupload, using EXIF

Post by Streamer76 » Fri Mar 01, 2019 5:01 pm

This is really annoying problem. Any ideas on this? (cannot test this on this forum because of file size limit, I can send someone some pictures if someone is willing to test those on some other board)

Streamer76
Registered User
Posts: 58
Joined: Mon Dec 17, 2007 6:26 pm

Re: Image orientation in plupload, using EXIF

Post by Streamer76 » Tue Apr 30, 2019 6:11 pm

Any new ideas to solve this :?:

KYPREO
Registered User
Posts: 94
Joined: Fri Feb 02, 2018 9:56 am
Contact:

Re: Image orientation in plupload, using EXIF

Post by KYPREO » Wed May 01, 2019 10:57 pm

Streamer76 wrote:
Tue Apr 30, 2019 6:11 pm
Any new ideas to solve this :?:
The image rotation based on EXIF is performed by plupload. This only happens when you set maximum image dimensions which then forces plupload to reduce the image size.

In your settings, maximum image size is 0 x 0 so plupload is not engaged.

Change the maximum image dimensions in the ACP to say 960x720.

Now try uploading an image again.

In order to fix image rotation when you don't have a maximum image dimension set, you need to use this extension: viewtopic.php?f=456&t=2477256
phpBB user since 2002
www.AusRotary.com

Streamer76
Registered User
Posts: 58
Joined: Mon Dec 17, 2007 6:26 pm

Re: Image orientation in plupload, using EXIF

Post by Streamer76 » Sat May 04, 2019 10:10 am

Thanks!
Last edited by Mick on Sat May 04, 2019 10:40 am, edited 1 time in total.
Reason: Removed unnecessary quoting.

Post Reply

Return to “phpBB Discussion”

cron