Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-15321

Orientation of Images

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 3.2.1
    • Posting
    • None
    • CentOS 7, PHP 7.0.22

      Phones, cameras and other devices often use the orientation flag in the EXIF meta data, For portraits the raw file data is flipped sideways but most browsers support this flag and flip the image to the correct orientation.

      plupload handles this correctly when resizing client side and preserves the EXIF data. Thumbnails processed by phpBB have the EXIF data stripped and the browser orients the image based on the raw file, sideways if it's s portrait.

      https://www.phpbb.com/community/viewtopic.php?f=556&t=2434416#p14802971

      Both Imagemagick and GD can handle this, for example if Imagemcick is selected for image manipulation on line 564 of includes/functions_posting.php if you add the -auto-orient flag you get the desired orientation for the thumbnail.

      @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) . '"');
      

      AFAIK Imagemagick should not be stripping the EXIF data to begin with, not sure why it is being stripped. Might be something to explore.

      For GD to handle it correctly I believe the EXIF extension would need to be installed. I would propose a suitable solution may be having plupload handle thumbnail creation, that would avoid issues with server side compatibility.

            Unassigned Unassigned
            thecoalman thecoalman
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: