mirror of
https://github.com/HaschekSolutions/pictshare.git
synced 2025-11-11 18:56:21 +00:00
Add support for flipping images too
This commit is contained in:
@@ -32,12 +32,29 @@ class ImageController implements ContentController
|
|||||||
$exif = exif_read_data($tmpfile);
|
$exif = exif_read_data($tmpfile);
|
||||||
if (!empty($exif['Orientation'])) {
|
if (!empty($exif['Orientation'])) {
|
||||||
switch ($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:
|
case 3:
|
||||||
$res = imagerotate($res, 180, 0);
|
$res = imagerotate($res, 180, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
imageflip($res, IMG_FLIP_VERTICAL);
|
||||||
|
// Also rotate
|
||||||
case 6:
|
case 6:
|
||||||
$res = imagerotate($res, -90, 0);
|
$res = imagerotate($res, -90, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 7:
|
||||||
|
imageflip($res, IMG_FLIP_VERTICAL);
|
||||||
|
// Also rotate
|
||||||
case 8:
|
case 8:
|
||||||
$res = imagerotate($res, 90, 0);
|
$res = imagerotate($res, 90, 0);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user