Not a bug Half of mobile images displayed wrong

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/
 
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.
 
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.
 
Top Bottom