ElkArte Community

Project Support => Support => Topic started by: Jorin on October 18, 2016, 05:29:11 am

Title: wrong direction of images
Post by: Jorin on October 18, 2016, 05:29:11 am
Look at the attachments here please:

http://forum-alternative-antriebe.de/index.php/topic,6042.msg96948.html#msg96948

They are shown in their correct direction. If you click on a thumbnail to see the original size of the image the picture will be turned somehow.

I think this has something to do with apple devices[1]. Is there any way to fix this?
Again... Let's spend some bucks so Emanuele can buy an older iPhone!
Title: Re: wrong direction of images
Post by: emanuele on October 18, 2016, 05:40:05 am
I think I have an account there, right? (Since the link you posted is registered only.)

/me looks around for the password. xD
Title: Re: wrong direction of images
Post by: Jorin on October 18, 2016, 05:49:04 am
Yes, you have. Do you need a new password?

You (and others) can use this account:

username: ---
password: ---

I will change the password from time to time to prevent spam.


Changed the account...
Title: Re: wrong direction of images
Post by: Spuds on October 18, 2016, 06:34:20 am
I have not looked at the pictures but I'll describe the issue as I did Here (http://www.elkarte.net/community/index.php?topic=2509.msg16672#msg16672)

Apple saves images with an "orientation flag" indicating what direction and which camera front/back.  Now they could have auto corrected the saved image and saved the internet a bunch of headaches, but they wanted to say how much faster their phone was a shooting pictures then others, and you can't be fast if you are doing the corrections.  Instead they tossed it out to the internet to take care of and so began years of wrong orientation images. 

In an effort to help, folks would edit the image and rotate them, but the programs doing so did not know about the new orientation flag, so it would remain set even though the image was now correct.  That image when shown on a system that understood the orientation flag would be rotated the wrong direction but appear correct on an older system, brilliant!

Elkarte does attempt to correct for the orientation flag but requires that you use ImageMagick instead of GD (setting in your ACP).  Also I remember opening a bug report, or maybe a discussion here, where there were some cases when that process was not called,  it may have been for images under a certain size or something, but I can' remember right now ... to early, need more coffee



Title: Re: wrong direction of images
Post by: Jorin on October 18, 2016, 06:58:00 am

Oh, sorry.

Quote from: Spuds – Elkarte does attempt to correct for the orientation flag but requires that you use ImageMagick instead of GD (setting in your ACP).

Hm, I can't find the point to edit the setting in my ACP.  O:-)  The search box in my ACP didn't find anything, and me too.
Title: Re: wrong direction of images
Post by: Spuds on October 18, 2016, 08:02:46 am
Found the issue that I recalled on this .. https://github.com/elkarte/Elkarte/issues/2404

Since your thumbnails are correct, the code ran when it created them and corrected the orientation.  However the full images themselves were not changed (resized nor re-encoded) so they were left "as taken".   The issue above notes that the orientation code will not get run in all cases when in fact it should ... call it a bug if you like.
Title: Re: wrong direction of images
Post by: Jorin on October 18, 2016, 08:17:32 am
Okay, then we call it an apple bug (https://www.google.de/?gws_rd=ssl#q=apfelk%C3%A4fer)! rofl

Thanks for the help, though there isn't any solution. I will inform my members to check the orientation of attachments made with apple devices.
Title: Re: wrong direction of images
Post by: emanuele on November 02, 2016, 10:35:18 am
xref:
Quote from: https://github.com/elkarte/Elkarte/issues/2404Considering also this:
http://www.elkarte.net/community/index.php?topic=4068.msg29112#msg29112
what would you think about moving this out to 2.0 and write up a "small" (maybe large, who knows LOL) javascript thingy to let the user decide the rotation when uploading the picture?
Something like:
1) upload,
2) small preview (or big if the flag is detected),
3) if the flag is detected, a pair of "rotate +90°"/"rotate -90°",
4) once the rotation is confirmed post it to the server and let IM do its magik.
Title: Re: wrong direction of images
Post by: Spuds on November 02, 2016, 07:19:06 pm
Maybe a nice feature for 2.0.   I'd still like to see us fix the processing "path" for 1.1 so the existing code fires every time as I feel it will be correct >95% of the time.
Title: Re: wrong direction of images
Post by: Jorin on July 05, 2017, 01:12:08 am
If you need an example: http://forum-alternative-antriebe.de/index.php/topic,6943.0.html

Still have problems with this thingy. Avatar images, attached images... Often in the wrong direction because a lot of my users seem to use Apple devices. A solution for 1.1 would be really great!
Title: Re: wrong direction of images
Post by: radu81 on July 05, 2017, 02:45:37 am
A solution for 1.0.x already exists, it was introduced into the core of elkarte since 1.0.10. Have you enabled in ACP > Forum > Attachments and avatars > Attachment Settings -> Detect and fix improperly rotated images ?

You can do a test using these images: https://github.com/recurser/exif-orientation-examples
Title: Re: wrong direction of images
Post by: Jorin on July 05, 2017, 02:55:26 am
No, I hadn't. Don't know this option is available now within 1.0.10.  :-[

I activated it now, but the images are still false rotated. Does it work only with new attached images?
Title: Re: wrong direction of images
Post by: radu81 on July 05, 2017, 03:23:13 am
Yes, only with newer images since they are rotated during upload.
Title: Re: wrong direction of images
Post by: Jorin on July 05, 2017, 03:27:23 am
Ah, okay. Thanks, I will test it.
Title: Re: wrong direction of images
Post by: Jorin on July 19, 2017, 04:28:49 pm
Here's an example. With my Chrome the thumbnail is false rotated, the full image is correct. With my IE in my office both the thumbnail AND the full image is not correct!  :-X

http://forum-alternative-antriebe.de/index.php/topic,7062.msg117144.html#msg117144

So we still have a problem with the wrong direction of images.
Title: Re: wrong direction of images
Post by: Spuds on July 20, 2017, 12:20:43 pm
Are you running GD2 or Imagik for your image processing?  If GD2, you also need to have the php exif extension loaded.
Title: Re: wrong direction of images
Post by: Jorin on July 21, 2017, 12:56:33 am
Here's what my PHP-Info says:

GD Support  enabled 
GD Version  bundled (2.1.0 compatible) 
FreeType Support  enabled 
FreeType Linkage  with freetype 
FreeType Version  2.4.8 
T1Lib Support  enabled 
GIF Read Support  enabled 
GIF Create Support  enabled 
JPEG Support  enabled 
libJPEG Version  8 
PNG Support  enabled 
libPNG Version  1.2.46 
WBMP Support  enabled 
XPM Support  enabled 
libXpm Version  30411 
XBM Support  enabled 
WebP Support  enabled 

EXIF Support  enabled 
EXIF Version  1.4 $Id: 1c8772f76be691b7b3f77ca31eb788a2abbcefe5 $ 
Supported EXIF Version  0220 
Supported filetypes  JPEG,TIFF 

imagick module version  3.4.1 
imagick classes  Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator 
Imagick compiled with ImageMagick version  ImageMagick 6.6.9-7 2014-03-06 Q16 http://www.imagemagick.org 
Imagick using ImageMagick library version  ImageMagick 6.6.9-7 2017-03-14 Q16 http://www.imagemagick.org 
ImageMagick copyright  Copyright (C) 1999-2011 ImageMagick Studio LLC 
ImageMagick release date  2017-03-14 
ImageMagick number of supported formats:  206 

What's running, GD or Imagick? Or both? I don't know.  :-[

But if EXIF is only enabled for JPEG and TIFF, maybe that's the problem? Shouldn't it be enabled too for JPG?
Title: Re: wrong direction of images
Post by: Spuds on July 21, 2017, 07:40:39 am
The system will choose Imagick over GD when both are available.

Looks like you have all the needed prerequisites on the server to do the rotation so ......... not sure.  Could still be a bug that is preventing or skipping the rotation  (we had and fixed one of those), or a bad image (sometimes an image rotation was "fixed"  by a program that does not update the orientation flag).  

Any way I could get the original image to test so I can see what may be occurring?
Title: Re: wrong direction of images
Post by: Jorin on July 24, 2017, 12:50:25 am
Sure. You can see/dopwnload it in the post itself:

http://forum-alternative-antriebe.de/index.php/topic,7062.msg117144.html#msg117144

(it's the last one with the yellow cab)

I also downloaded it for you and attached it here. But here it is in the right direction, in my board not.  :o
Title: Re: wrong direction of images
Post by: radu81 on July 24, 2017, 03:10:58 am
I think Spuds asked for the original image, not the image published on your forum or resized by your forum.You should ask your member to send it by mail, better if zipped, just to be sure that email client did not modify in any way that image.

Have you tried this?
Quote from: radu81 – You can do a test using these images: https://github.com/recurser/exif-orientation-examples

Title: Re: wrong direction of images
Post by: Jorin on July 24, 2017, 03:34:52 am
Thanks, radu, I asked for the image.

No, I haven't tried them yet. I will soon.
Title: Re: wrong direction of images
Post by: Jorin on July 25, 2017, 12:48:13 am
@Spuds here it is.
Title: Re: wrong direction of images
Post by: radu81 on July 25, 2017, 05:51:38 am
@Jorin‍ on my forum the image is correctly rotated (thumbnail and full image)

Title: Re: wrong direction of images
Post by: Jorin on July 25, 2017, 06:19:52 am
It seems to depend on the browser.
Title: Re: wrong direction of images
Post by: Spuds on July 25, 2017, 07:28:21 am
Thank you for the photo ... that will help.  

I can at least confirm that the EXIF data on your site shows the photo is rotated 180, which means the orientation function did not, or failed, to run.  If it had run, it would set the flag as a normal image. 

With that flag at 180 its up the the viewing application to use it or not, some do, some don't.  That of course is why we have the rotation function to begin with.

I can also confirm that you site is running the imagick functions.

I think you also use the image resize addon, please confirm.
Title: Re: wrong direction of images
Post by: Jorin on July 26, 2017, 02:46:37 am
Quote from: Spuds – I think you also use the image resize addon, please confirm.

Yes, I do.
Title: Re: wrong direction of images
Post by: Spuds on July 26, 2017, 08:55:16 pm
I have this sorted, at least I think so.

The problem is an incompatibility between the 1.0.10 rotation updates and the attachment image resize addon under certain conditions.  Easy fix but want to do a few more tests before I release an update.
Title: Re: wrong direction of images
Post by: Spuds on July 27, 2017, 09:35:32 am
Updated to v1.0.4 .... get it here: http://addons.elkarte.net/utility/Attachment-Resize.html

Download the new package or use the package server function,  Uninstall 1.0.3 and install 1.0.4 ...
Title: Re: wrong direction of images
Post by: Jorin on July 28, 2017, 02:19:45 am
Quote from: Jorin – Sure. You can see/dopwnload it in the post itself:

http://forum-alternative-antriebe.de/index.php/topic,7062.msg117144.html#msg117144

(it's the last one with the yellow cab)

I deinstalled my 1.0.2 and installed your 1.0.4, but still the wrong direction (using latest Chrome Browser) of the thumbnail. The image itself, if clicked on the thumbnail, is rotated correct.  :(
Title: Re: wrong direction of images
Post by: emanuele on July 28, 2017, 02:33:21 am
Did you upload again the picture?
I think the correction is applied when the image is uploaded (but I may be wrong!).
Title: Re: wrong direction of images
Post by: Jorin on July 28, 2017, 04:59:01 am
This I did not.  :-[

Yet I did. It's perfect now! Thank you very much, @Spuds !  :)