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

Is XenForos ImageMagick too late for the original file, can only manipulate thumbnails?

Discussion in 'XenForo Development Discussions' started by Marcus, Sep 25, 2013.

  1. Marcus

    Marcus Well-Known Member

    This is for: http://xenforo.com/community/resources/auto-image-orientation-for-iphone-and-ipad.1755/

    This addon rotates the thumbnail in the right position, however in full view the picture is still not rotated. Is the full image already saved before this class is triggered and am I too late here? If yes, can I still have access to the original image to rotate it right?
    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);
      break;

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

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

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

      return 
    parent::_setImage($image);
      }
    }
     

    Attached Files:

  2. Marcus

    Marcus Well-Known Member

    This class is first executed in XenForo_Upload::_checkImageState()

    XenForo_Model_Attachment::insertUploadedAttachmentData() writes to XenForo_DataWriter_AttachmentData

    Is it more convenient to extend XenForo_DataWriter_AttachmentData::_preSave()?
     

Share This Page