Skip to content

Commit

Permalink
Re-enable auto orientation for gd driver
Browse files Browse the repository at this point in the history
  • Loading branch information
olivervogel committed Nov 27, 2023
1 parent 59832ad commit 81b95db
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/Drivers/Gd/Decoders/BinaryImageDecoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,17 @@ public function decode($input): ImageInterface|ColorInterface
$this->decodeExifData($input)
);

return $image;

// fix image orientation
// return match ($image->exif('IFD0.Orientation')) {
// 2 => $image->flip(),
// 3 => $image->rotate(180),
// 4 => $image->rotate(180)->flip(),
// 5 => $image->rotate(270)->flip(),
// 6 => $image->rotate(270),
// 7 => $image->rotate(90)->flip(),
// 8 => $image->rotate(90),
// default => $image
// };
return match ($image->exif('IFD0.Orientation')) {
2 => $image->flip(),
3 => $image->rotate(180),
4 => $image->rotate(180)->flip(),
5 => $image->rotate(270)->flip(),
6 => $image->rotate(270),
7 => $image->rotate(90)->flip(),
8 => $image->rotate(90),
default => $image
};
}

private function coreFromString(string $input): Core
Expand Down

0 comments on commit 81b95db

Please sign in to comment.