1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Not a Bug Half of mobile images displayed wrong

Discussion in 'Resolved Bug Reports' started by Marcus, Sep 28, 2013.

  1. Marcus

    Marcus Well-Known Member

    Half of all images uploaded by mobile devices are displayed wrong in xenForo as it does not handle image orientation. This is true for all kind of photos taken from a mobile device. This would just correct the upload for thumbnails and not for the full image for ImageMagick:
    PHP:
    class AutoRotate_Image_Imagemagick_Pecl extends XFCP_AutoRotate_Image_Imagemagick_Pecl
    {
      protected function 
    _setImage(Imagick $image)
      {
      
    $orientation $image->getImageOrientation();

      switch(
    $orientation) {
      case 
    Imagick::ORIENTATION_BOTTOMRIGHT:
      
    $image->rotateimage(new ImagickPixel(), 180); // rotate 180 degrees
      
    break;

      case 
    Imagick::ORIENTATION_RIGHTTOP:
      
    $image->rotateimage(new ImagickPixel(), 90); // rotate 90 degrees CW
      
    break;

      case 
    Imagick::ORIENTATION_LEFTBOTTOM:
      
    $image->rotateimage(new ImagickPixel(), -90); // rotate 90 degrees CCW
      
    break;
      }

      
    $image->setImageOrientation(Imagick::ORIENTATION_TOPLEFT);

      return 
    parent::_setImage($image);
      }
    }
    "Quick and dirty" file modification: http://xenforo.com/community/resources/auto-image-rotate-for-iphone-and-ipad.1755/
     
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

  3. Marcus

    Marcus Well-Known Member

    The other bug report was classified to "Not a bug" due to "it's the iOS fault not storing EXIM", which is not true as my addon fetches EXIM information from the pictures to rotate it.
     
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

  5. Marcus

    Marcus Well-Known Member

    That's fine. I just wanted to clarify that there are EXIF information and it is possible to rotate it correctly. Whether or not or when it is done is of course the decision of the developers.
     

Share This Page