From e5a88c918f932bcee676bd42ea3b64a382afbbb9 Mon Sep 17 00:00:00 2001 From: Quentin Ligier Date: Sat, 20 Aug 2016 12:34:31 +0200 Subject: [PATCH 1/2] Rotate and flip the image with GD --- php/Modules/Photo.php | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/php/Modules/Photo.php b/php/Modules/Photo.php index 59fe4d0..6dc7fd8 100755 --- a/php/Modules/Photo.php +++ b/php/Modules/Photo.php @@ -554,8 +554,7 @@ final class Photo { case 2: // mirror - // not yet implemented - return false; + imageflip($sourceImg, IMG_FLIP_HORIZONTAL); break; case 3: @@ -564,14 +563,16 @@ final class Photo { case 4: // rotate 180 and mirror - // not yet implemented - return false; + imageflip($sourceImg, IMG_FLIP_VERTICAL); break; case 5: // rotate 90 and mirror - // not yet implemented - return false; + $sourceImg = imagerotate($sourceImg, -90, 0); + $newWidth = $info['height']; + $newHeight = $info['width']; + $swapSize = true; + imageflip($sourceImg, IMG_FLIP_HORIZONTAL); break; case 6: @@ -583,8 +584,11 @@ final class Photo { case 7: // rotate -90 and mirror - // not yet implemented - return false; + $sourceImg = imagerotate($sourceImg, 90, 0); + $newWidth = $info['height']; + $newHeight = $info['width']; + $swapSize = true; + imageflip($sourceImg, IMG_FLIP_HORIZONTAL); break; case 8: @@ -1308,4 +1312,4 @@ final class Photo { } -?> \ No newline at end of file +?> From eff2b34c7db59ec0f73da1c76cac1f73382edbe0 Mon Sep 17 00:00:00 2001 From: Quentin Ligier Date: Sat, 20 Aug 2016 12:36:27 +0200 Subject: [PATCH 2/2] Coding style --- php/Modules/Photo.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/php/Modules/Photo.php b/php/Modules/Photo.php index 6dc7fd8..59beb77 100755 --- a/php/Modules/Photo.php +++ b/php/Modules/Photo.php @@ -569,10 +569,10 @@ final class Photo { case 5: // rotate 90 and mirror $sourceImg = imagerotate($sourceImg, -90, 0); - $newWidth = $info['height']; - $newHeight = $info['width']; - $swapSize = true; - imageflip($sourceImg, IMG_FLIP_HORIZONTAL); + $newWidth = $info['height']; + $newHeight = $info['width']; + $swapSize = true; + imageflip($sourceImg, IMG_FLIP_HORIZONTAL); break; case 6: @@ -585,10 +585,10 @@ final class Photo { case 7: // rotate -90 and mirror $sourceImg = imagerotate($sourceImg, 90, 0); - $newWidth = $info['height']; - $newHeight = $info['width']; - $swapSize = true; - imageflip($sourceImg, IMG_FLIP_HORIZONTAL); + $newWidth = $info['height']; + $newHeight = $info['width']; + $swapSize = true; + imageflip($sourceImg, IMG_FLIP_HORIZONTAL); break; case 8: