/** * rotate an imagick object based on it's exif data. * * @param imagick $image an instance of imagick * @return void */ protected function _exifRotateImagick($image) { $orientation = $image->getImageOrientation(); $trans = $this->_exifOrientationTransformations($orientation); if ($trans['flip_vert']) { $image->flopImage(); } if ($trans['flip_horz']) { $image->flipImage(); } if ($trans['rotate_clockwise']) { $image->rotateimage("#000", $trans['rotate_clockwise']); } $image->setImageOrientation(imagick::ORIENTATION_TOPLEFT); }