[3.2][ALPHA] EXIR - Exif Image Rotation

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Suggested Hosts
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
User avatar
KYPREO
Registered User
Posts: 71
Joined: Fri Feb 02, 2018 9:56 am
Contact:

Re: [3.2][ALPHA] EXIR - Exif Image Rotation

Post by KYPREO » Wed Jul 04, 2018 10:02 am

On a side note, stripping EXIF data upon upload is a comforting feature from a user security perspective. I actually had a user ask about this once. My forum is focused around cars and having location data able to be publicly extracted from EXIF data in uploaded photos is obviously not a good idea!
phpBB user since 2002
www.AusRotary.com

User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 2796
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: [3.2][ALPHA] EXIR - Exif Image Rotation

Post by thecoalman » Wed Jul 04, 2018 10:21 am

tojag wrote:
Wed Jul 04, 2018 8:45 am
Early I tried this:

Code: Select all

@passthru(escapeshellcmd($config['img_imagick']) . 'convert' . ((defined('PHP_OS') && preg_match('#^win#i', PHP_OS)) ? '.exe' : '') . ' -auto-orient -quality 85 -resize 600' . ' "' . str_replace('\\', '/', $source) . '" "' . str_replace('\\', '/', $destination) . '"');
on my production server but without positive effect.
This requires Imagemagick is installed on the server and you enable it in the ACP. As already noted it only works for thumbs.

User avatar
3Di
Registered User
Posts: 12887
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: [3.2][ALPHA] EXIR - Exif Image Rotation

Post by 3Di » Wed Jul 04, 2018 12:58 pm

tojag wrote:
Wed Jul 04, 2018 8:45 am
Thanks for this extension!

My production server works with php7.2. I think it should works.
Thanks for feedback. I don't see why it should not.
tojag wrote:
Wed Jul 04, 2018 8:45 am
Early I tried this:

Code: Select all

@passthru(escapeshellcmd($config['img_imagick']) . 'convert' . ((defined('PHP_OS') && preg_match('#^win#i', PHP_OS)) ? '.exe' : '') . ' -auto-orient -quality 85 -resize 600' . ' "' . str_replace('\\', '/', $source) . '" "' . str_replace('\\', '/', $destination) . '"');
on my production server but without positive effect.
As I above said
3Di wrote:
Mon Jul 02, 2018 12:22 pm
To be more precise, the image will be rotated prior of the native create_thumbnail()'s execution (see above code, the last line), which will use ImageMagik if it is present (active), yes.
To resume, the image is rotated and exif data are stripped BEFORE of the creation of the thumbnails - which works accordingly with the active presence of ImageMagik (if active will be used else GD).

Hence you don't need that bit of modification since the image will be not rotated anymore being that job already been done.
Imagemagik/GD in this case will create a thumbnail of the already rotated image.
KYPREO wrote:
Wed Jul 04, 2018 10:02 am
On a side note, stripping EXIF data upon upload is a comforting feature from a user security perspective. I actually had a user ask about this once. My forum is focused around cars and having location data able to be publicly extracted from EXIF data in uploaded photos is obviously not a good idea!
Yes, I agree.
Please note though that if the image doesn't need a rotation it will be passed as is, with the exif data still there, that's due to the fact the logic skips its job in such cases. At this point it is the native core code which takes the image into its own hands and elaborate it.
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

User avatar
tojag
Registered User
Posts: 336
Joined: Thu Aug 07, 2014 8:00 am
Location: Warsaw, Poland, EU
Name: Gregory

Re: [3.2][ALPHA] EXIR - Exif Image Rotation

Post by tojag » Fri Jul 06, 2018 8:27 am

Hi
After installing and enabling the extension on my production server ... it does not work.
I compared the settings with the test server. It works if it is set in ACP "Maximum image dimensions: 0x0". I have 800x600 on the production server and unfortunately it does not work then. The problem is probably due to the reduction of the photo to the limit specified in ACP.

I have enable ImageMagik and a fix in includes/functions_posting.php.

User avatar
3Di
Registered User
Posts: 12887
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: [3.2][ALPHA] EXIR - Exif Image Rotation

Post by 3Di » Fri Jul 06, 2018 12:28 pm

tojag wrote:
Fri Jul 06, 2018 8:27 am
a fix in includes/functions_posting.php.
Vague, expand pls.

Do it here: https://github.com/3D-I/phpBB-Exif-Imag ... new/choose if possible, I will appreciate.

That's for all, reporting a bug it it's ok if and only if that "bug" is really and accurately described.
That helps a lot when it comes to reproduce it and eventually code a fix.

Here is how a 🐞 bug should be reported: viewtopic.php?p=15043206#p15043206
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

User avatar
thecoalman
Community Team Member
Community Team Member
Posts: 2796
Joined: Wed Dec 22, 2004 3:52 am
Location: Pennsylvania, U.S.A.
Contact:

Re: [3.2][ALPHA] EXIR - Exif Image Rotation

Post by thecoalman » Fri Jul 06, 2018 1:01 pm

tojag wrote:
Fri Jul 06, 2018 8:27 am
I have enable ImageMagik and a fix in includes/functions_posting.php.
The code I posted has nothing to do with this extension but it shouldn't cause any issues either.

User avatar
tojag
Registered User
Posts: 336
Joined: Thu Aug 07, 2014 8:00 am
Location: Warsaw, Poland, EU
Name: Gregory

Re: [3.2][ALPHA] EXIR - Exif Image Rotation

Post by tojag » Fri Jul 06, 2018 1:21 pm

To reproduce:
1. In ACP "Maximum image dimensions:" change from 0x0 to eg. 800x600.
2. Download and post 1st picture from this post. It is iPad mini 4 picture.

When "Maximum image dimensions:0x0" every think is ok. When "Maximum image dimensions:800x600" this picture is sideways.
3Di wrote:
Fri Jul 06, 2018 12:28 pm
tojag wrote:
Fri Jul 06, 2018 8:27 am
a fix in includes/functions_posting.php.
Vague, expand pls.
According to this in includes/functions_posting line 564.

Code: Select all

@passthru(escapeshellcmd($config['img_imagick']) . 'convert' . ((defined('PHP_OS') && preg_match('#^win#i', PHP_OS)) ? '.exe' : '') . ' -auto-orient -quality 85 -resize XXX' . ' "' . str_replace('\\', '/', $source) . '" "' . str_replace('\\', '/', $destination) . '"');
But it does not matter, I am return the original function_posting.

My test environment:
xampp 7.2.6 {Apache/2.4.33 (Win32), OpenSSL/1.1.0h, PHP/7.2.6, 10.1.33-MariaDB }
FireFox 61.0.1
phpBB 3.2.2

enabled extensions:
Advanced BBCode Box 3.1.4
Confirm Email 1.0.0
Disable all extensions 2.1.0
Exif Image Rotation 1.0.0-alpha
Large Font 3.2.0
Lightbox 1.0.5
New user default settings 2.1.0-RC1
Pages 2.0.2
phpBB.de - External Image as Link 1.2.0
phpBB Media Embed PlugIn 1.0.1
Privacy policy 2.1.0-rc6

User avatar
3Di
Registered User
Posts: 12887
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: [3.2][ALPHA] EXIR - Exif Image Rotation

Post by 3Di » Fri Jul 06, 2018 2:09 pm

tojag wrote:
Fri Jul 06, 2018 1:21 pm
My test environment:
xampp 7.2.6 {Apache/2.4.33 (Win32), OpenSSL/1.1.0h, PHP/7.2.6, 10.1.33-MariaDB }
FireFox 61.0.1
phpBB 3.2.2
I did some test with the same environment
  • PHP 7.2.6
  • Apache/2.4.33
  • FireFox up-to-date
  • phpBB 3.2.2
  • Only this extension enabled
I do confirm what you said here
tojag wrote:
Fri Jul 06, 2018 8:27 am
It works if it is set in ACP "Maximum image dimensions: 0x0".
See: http://prntscr.com/k3byvx

On a side note, I noticed the issue with the filesize of the attachment(s)
  • If dimension 0x0 then the filesize is retained (approx. 1/1) and the img rotated as it should be.
  • If dimension 800x600 (or whatever) then the filesize gets drastically reduced (2/3 - which is not the logic of this extension) and the img is not being rotated
You can see that if you click on the Attachments Tab on editing the post. See: http://prntscr.com/k3by87

I haven't go further for the moment since I am busy right now, BUT the image is being FIRST manipulated by phpBB in this case (in fact it lost all of its Exif data).. hence the logic can't rotate it because there are no Exif 'rotation' metadata anymore to work with.
tojag wrote:
Fri Jul 06, 2018 8:27 am
....The problem is probably due to the reduction of the photo to the limit specified in ACP.
Indeed that bit extra needs to be studied a little, I will do it as soon as I will get some spare time.
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

User avatar
tojag
Registered User
Posts: 336
Joined: Thu Aug 07, 2014 8:00 am
Location: Warsaw, Poland, EU
Name: Gregory

Re: [3.2][ALPHA] EXIR - Exif Image Rotation

Post by tojag » Sun Jul 08, 2018 9:23 pm

I know that when I specify a resolution limit, the volume of the file is reduced. That's why I turn it on. Otherwise attachments with photos of 5-10MB would fill my server quickly :)
Rest to check. Thanks.

User avatar
3Di
Registered User
Posts: 12887
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: [3.2][ALPHA] EXIR - Exif Image Rotation

Post by 3Di » Sun Jul 08, 2018 10:02 pm

tojag wrote:
Sun Jul 08, 2018 9:23 pm
<SNIP> That's why I turn it on. Otherwise attachments with photos of 5-10MB would fill my server quickly..
At the moment, all that remains for me to do is to assert that the extension works, as well as with all the other pre-existing requirements, only if the ACP/attachments settings "Maximum image dimensions:" is set to 0x0. (first post updated)

As I mentioned the matter will be thoroughly studied as soon as I get my hands on this code, for the moment I'm engaged in other projects for customers, so we keep updated on the next turn of the mark.

Thanks. :)
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

sp3ctre
Registered User
Posts: 274
Joined: Sun Jul 15, 2007 11:06 am

Re: [3.2][ALPHA] EXIR - Exif Image Rotation

Post by sp3ctre » Fri Sep 14, 2018 11:34 am

Just tested on my 3.2.3 forum (PHP 7.2). Used an iPhone 7 and both landscape and portrait images display as intended.

Nice work

User avatar
3Di
Registered User
Posts: 12887
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: [3.2][ALPHA] EXIR - Exif Image Rotation

Post by 3Di » Fri Sep 14, 2018 9:27 pm

Thx for feedback. :)
Yeah, to still be in alpha stage let's say it does what it is written on the box.
In the future there will be other options as I have already said.
Want to compensate me for my interest? Donate
Please PM me only to request paid works. Thx.
Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

Post Reply

Return to “Extensions in Development”

Who is online

Users browsing this forum: Galixte de EzCom, Paul, Peter77sx, profKroy and 24 guests