public function rotate($angle, $bgColor = null, $ignoreTransparent = true) { if ((int) $angle !== 0) { $this->image = $this->image->rotate($angle, $bgColor, $ignoreTransparent); } return $this; }
/** * Rotates and mirrors and image properly based on current orientation value * * @param WideImage_Image $img * @param int $orientation * @return WideImage_Image */ function execute($img, $orientation) { switch ($orientation) { case 2: return $img->mirror(); break; case 3: return $img->rotate(180); break; case 4: return $img->rotate(180)->mirror(); break; case 5: return $img->rotate(90)->mirror(); break; case 6: return $img->rotate(90); break; case 7: return $img->rotate(-90)->mirror(); break; case 8: return $img->rotate(-90); break; default: return $img->copy(); } }
public function orientateImage() { if (!function_exists('exif_read_data')) { return $this; } $exif = exif_read_data($this->sourcePath); if (!empty($exif['Orientation'])) { switch ($exif['Orientation']) { case 8: $this->image = $this->image->rotate(-90); break; case 3: $this->image = $this->image->rotate(180); break; case 6: $this->image = $this->image->rotate(90); break; } } return $this; }