rotate images / attachments

Do not post support requests, bug reports or feature requests. Discuss phpBB here. Non-phpBB related discussion goes in General Discussion!
Anti-Spam Guide
rxu
Extensions Development Team
Posts: 2866
Joined: Wed Oct 25, 2006 12:46 pm
Location: Siberia, Russian Federation
Name: Ruslan
Contact:

Re: rotate images / attachments

Post by rxu » Sun Aug 13, 2017 7:05 pm

thecoalman wrote:
Sun Aug 13, 2017 6:43 pm
This is only for new uploads, correct?
I guess so.

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

Re: rotate images / attachments

Post by thecoalman » Sun Aug 13, 2017 7:09 pm

3Di wrote:
Sun Aug 13, 2017 7:00 pm


About physical button on your phone and attachs posted via phone etc..
I'm well aware of why this happens, I actually gave very detailed reason why. plupload handles this correctly, it's only the thumbnail generated server side that is an issue.

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

Re: rotate images / attachments

Post by 3Di » Sun Aug 13, 2017 7:22 pm

thecoalman wrote:
Sun Aug 13, 2017 7:09 pm
3Di wrote:
Sun Aug 13, 2017 7:00 pm


About physical button on your phone and attachs posted via phone etc..
I'm well aware of why this happens, I actually gave very detailed reason why. plupload handles this correctly, it's only the thumbnail generated server side that is an issue.
Feel free to PM me a zipped file containing some of those images (the originals ;) ) if you like, I will use them for some test here.
Last edited by 3Di on Sun Aug 13, 2017 7:25 pm, edited 1 time in total.
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate

:game_die: The new Dice Roller extension for phpBB 3.2 is out! :game_die:

Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

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

Re: rotate images / attachments

Post by canonknipser » Sun Aug 13, 2017 7:24 pm

thecoalman wrote:
Sun Aug 13, 2017 7:09 pm
it's only the thumbnail generated server side that is an issue.
See: http://canonknipser.com/viewtopic.php?f=6&t=12#p39
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

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

Re: rotate images / attachments

Post by thecoalman » Sun Aug 13, 2017 7:52 pm

3Di wrote:
Sun Aug 13, 2017 7:22 pm
Feel free to PM me a zipped file containing some of those images (the originals ;) ) if you like, I will use them for some test here.
viewtopic.php?f=556&t=2434416#p14802971

There is example I already uploaded to this topic. If you click the thumbnail that is sideways you'll see the original is fine. That is actually the source image because it doesn't look like phpbb.com using limits on the file dimensions. Uploading that same image with max dimensions set to 500 on my test forum also produces the correct orientation for the resized image, that is being handled by plupload client side .

It's only the thumbnails being handled incorrectly but those are resized server side. One other thing to note is if you are using Imagemagick it should also maintain the orientation because by default it handles the orientation.

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

Re: rotate images / attachments

Post by thecoalman » Sun Aug 13, 2017 7:55 pm

canonknipser wrote:
Sun Aug 13, 2017 7:24 pm
thecoalman wrote:
Sun Aug 13, 2017 7:09 pm
it's only the thumbnail generated server side that is an issue.
See: http://canonknipser.com/viewtopic.php?f=6&t=12#p39
Thanks, that may be very handy. I have 60K images that have been uploaded over the years...no it's not a porn site. :D Many of them have smaller thumbnails from more than decade ago when disk space was concern

DWFII
Registered User
Posts: 330
Joined: Fri Oct 20, 2006 2:17 am
Name: D.W.
Contact:

Re: rotate images / attachments

Post by DWFII » Sun Aug 13, 2017 9:06 pm

Your one attached image not withstanding, if you check the link I provided above the attached images do not reorient correctly. The thumb is rotated and the full size images are rotated. This on two separate computers.
DWFII
In the High Desert of Central Oregon

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

Re: rotate images / attachments

Post by 3Di » Sun Aug 13, 2017 9:17 pm

DWFII wrote:
Sun Aug 13, 2017 9:06 pm
Your one attached image not withstanding, if you check the link I provided above the attached images do not reorient correctly. The thumb is rotated and the full size images are rotated. This on two separate computers.
When you click on it yes, it remains the same rotation.
That's probably due to the extension you are using, if you right-click/view image on it then img is displayed at the right rotation.. see:

http://www.thehcc.org/forum/download/fi ... &mode=view
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate

:game_die: The new Dice Roller extension for phpBB 3.2 is out! :game_die:

Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

DWFII
Registered User
Posts: 330
Joined: Fri Oct 20, 2006 2:17 am
Name: D.W.
Contact:

Re: rotate images / attachments

Post by DWFII » Sun Aug 13, 2017 9:24 pm

3Di wrote:
Sun Aug 13, 2017 9:17 pm
DWFII wrote:
Sun Aug 13, 2017 9:06 pm
Your one attached image not withstanding, if you check the link I provided above the attached images do not reorient correctly. The thumb is rotated and the full size images are rotated. This on two separate computers.
When you click on it yes, it remains the same rotation.
That's probably due to the extension you are using, if you right-click/view image on it then img is displayed at the right rotation.. see:

http://www.thehcc.org/forum/download/fi ... &mode=view
So...I'm using Lightbox. But the extension is for phpBB--it "extends" phpBB.

That means...if I understand correctly...it is present when my phpBB forum is opened, via a browser, on a smartphone.

So my question is why would the extension create a problem on a PC but not on a smartphone? Same software.
DWFII
In the High Desert of Central Oregon

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

Re: rotate images / attachments

Post by 3Di » Sun Aug 13, 2017 9:36 pm

Try attaching the same image here and let's see what happens..
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate

:game_die: The new Dice Roller extension for phpBB 3.2 is out! :game_die:

Extensions, Scripts, MOD porting, Update/Upgrades
My development's activity º PhpStorm's proud user

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

Re: rotate images / attachments

Post by thecoalman » Sun Aug 13, 2017 10:05 pm

DWFII wrote:
Sun Aug 13, 2017 9:06 pm
Your one attached image not withstanding, if you check the link I provided above the attached images do not reorient correctly. The thumb is rotated and the full size images are rotated. This on two separate computers.
That has something to do with lighrbox. Here is the regular file and it's oriented correctly.

http://www.thehcc.org/forum/download/fi ... &mode=view

The thumbnail since it's been processed server side is wrong.

http://www.thehcc.org/forum/download/fi ... 53e3f36a0d
Last edited by thecoalman on Sun Aug 13, 2017 10:08 pm, edited 1 time in total.

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

Re: rotate images / attachments

Post by thecoalman » Sun Aug 13, 2017 10:07 pm

delete, double post

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

Re: rotate images / attachments

Post by thecoalman » Sun Aug 13, 2017 10:15 pm

After some sniffing around on line 564 of includes/function_posting.php

Code: Select all

@passthru(escapeshellcmd($config['img_imagick']) . 'convert' . ((defined('PHP_OS') && preg_match('#^win#i', PHP_OS)) ? '.exe' : '') . ' -quality 85 -geometry ' . $new_width . 'x' . $new_height . ' "' . str_replace('\\', '/', $source) . '" "' . str_replace('\\', '/', $destination) . '"');
Add -auto-orient

Code: Select all

@passthru(escapeshellcmd($config['img_imagick']) . 'convert' . ((defined('PHP_OS') && preg_match('#^win#i', PHP_OS)) ? '.exe' : '') . ' -auto-orient -quality 85 -geometry ' . $new_width . 'x' . $new_height . ' "' . str_replace('\\', '/', $source) . '" "' . str_replace('\\', '/', $destination) . '"');
This only works if you have set the board to use ImageMagick under attachment settings. This gives the desired result with correct orientation of thumbnail. Needs more modification because it's not setting the width to desired width.

I would assume that is this la few lines up from there but I'm off to drink some beer. :D

Code: Select all

	list($new_width, $new_height) = get_img_size_format($width, $height);

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

Re: rotate images / attachments

Post by thecoalman » Sun Aug 13, 2017 10:46 pm

DWFII wrote:
Sun Aug 13, 2017 5:42 pm
But this is weird...on the PC (in a 3.2 phpBB forum using Lightbox) the thumbnails are rotated and when the photo is clicked on, it opens up rotated. And very, very slowly.
I'm sure you are confused by now and I'm sorry for butting in on your thread.

Briefly the thumbnail and the lightbox rotation are two separate issues. The lightbox issue appears to be browser related hence the reason it works in your phone. Either the browser has to fixed or lightbox needs to be fixed, there is probably nothing you can do about this accept make sure you are using the latest version.

The code changes I posted will fix the thumbnail issue but it's a band aid at best and only works if you are using Imagemagick.

As far as the slow images go those files are huge. Go into attachment settings and set "Maximum image dimensions:" both to about 2000. Not only will it save you some bandwidth and disk space it will save the person uploading it some bandwidth because the file resizing is done on their computer/phone. Just so it's clear they won;t get warning the dimensions of the images are too big when they go to upload them.

DWFII
Registered User
Posts: 330
Joined: Fri Oct 20, 2006 2:17 am
Name: D.W.
Contact:

Re: rotate images / attachments

Post by DWFII » Sun Aug 13, 2017 11:32 pm

Coalman,

I appreciate your input...thank you.

Not entirely confused but, two things...first, I am having a hard time associating this problem with the browser. The images appear rotated both at as thumbnails and as full size photos on the latest versions of Chrome and Firefox. As well as IE. v.11.0.9600.

Second, I understand that Lightbox controls the size of the thumbnails but I am not certain it controls the full size images. The full size images...from IPhone...appear no larger (visually) than other images that I or others have posted / attached (maybe, in some cases even a bit smaller) but which seem to load far more quickly.

Third, I am not a coder. I am a clueless newbie (although not entirely, I hope) I don't know what the code you posted does nor where to insert it nor even which file to insert it into. ??

And finally, I don't know what ImageMagick is (I searched for it in the extensions database but no joy.
DWFII
In the High Desert of Central Oregon

Post Reply

Return to “phpBB Discussion”

Who is online

Users browsing this forum: Chico Gois and 38 guests