/** * Correct image orientation according to Exif data * * @param \Intervention\Image\Image $image * @return boolean */ public function execute($image) { switch ($image->exif('Orientation')) { case 2: $image->flip(); break; case 3: $image->rotate(180); break; case 4: $image->rotate(180)->flip(); break; case 5: $image->rotate(270)->flip(); break; case 6: $image->rotate(270); break; case 7: $image->rotate(90)->flip(); break; case 8: $image->rotate(90); break; } return true; }
/** * Applies filter effects to the given image * * @param Image\Image $image The image to filter. * * @return Image\Image The filtered image. * * @throws FilterException if an invalid mode has been given. */ public function applyFilter(Image\Image $image) { switch ($this->mode) { case self::FLIP_HORIZONTAL: return $image->flip('h'); case self::FLIP_VERTICAL: return $image->flip('v'); case self::ROTATE_LEFT: return $image->rotate(90); case self::ROTATE_RIGHT: return $image->rotate(-90); default: throw new FilterException('De bewerking die u gekozen heeft bestaat niet.', 1); } }
protected function rotation() { // Auto orientate $this->image->orientate(); if ($this->flip) { $this->image->flip($this->flip); } // Rotate within the existing frame if ($this->rotation) { $width = $this->image->getWidth(); $height = $this->image->getHeight(); $this->image->rotate($this->rotation); $this->image->crop($width, $height); } // Rotate entire image if ($this->orientation) { $this->image->rotate($this->orientation); } }
/** * Handle the image manipulation request * @param \Intervention\Image\Image $image * @param array $options * @return \Intervention\Image\Image */ public function handle($image, $options) { $options = array_merge($this->defaults, $options); return $image->flip($options['mode']); }
/** * Mirror image horizontally or vertically * * @param mixed $mode * @return \Intervention\Image\Image * @static */ public static function flip($mode = null) { return \Intervention\Image\Image::flip($mode); }