Skip to content

Commit

Permalink
Add support for flipping images too
Browse files Browse the repository at this point in the history
  • Loading branch information
wpf500 committed Aug 24, 2023
1 parent 2362af1 commit 7b4b270
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions content-controllers/image/image.controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,29 @@ public function handleUpload($tmpfile,$hash=false)
$exif = exif_read_data($tmpfile);
if (!empty($exif['Orientation'])) {
switch ($exif['Orientation']) {
case 2:
imageflip($res, IMG_FLIP_HORIZONTAL);
case 1:
// Nothing to do
break;

case 4:
imageflip($res, IMG_FLIP_HORIZONTAL);
// Also rotate
case 3:
$res = imagerotate($res, 180, 0);
break;

case 5:
imageflip($res, IMG_FLIP_VERTICAL);
// Also rotate
case 6:
$res = imagerotate($res, -90, 0);
break;

case 7:
imageflip($res, IMG_FLIP_VERTICAL);
// Also rotate
case 8:
$res = imagerotate($res, 90, 0);
break;
Expand Down

0 comments on commit 7b4b270

Please sign in to comment.