X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2FPhoto.php;h=785601c7e4eb3e15584645f7c9c660fa8d31d3f6;hb=08f276f87b366e5d9c6f92e1dd5edc3da633707e;hp=ccb6af29e92c22447a715e9d41c4483cd8501b99;hpb=106b0b5d23f36353eeff70946a51d848a8cb14ff;p=friendica.git diff --git a/include/Photo.php b/include/Photo.php index ccb6af29e9..785601c7e4 100644 --- a/include/Photo.php +++ b/include/Photo.php @@ -345,6 +345,24 @@ class Photo { } public function orient($filename) { + if ($this->is_imagick()) { + // based off comment on http://php.net/manual/en/imagick.getimageorientation.php + $orientation = $this->image->getImageOrientation(); + switch ($orientation) { + case imagick::ORIENTATION_BOTTOMRIGHT: + $this->image->rotateimage("#000", 180); + break; + case imagick::ORIENTATION_RIGHTTOP: + $this->image->rotateimage("#000", 90); + break; + case imagick::ORIENTATION_LEFTBOTTOM: + $this->image->rotateimage("#000", -90); + break; + } + + $this->image->setImageOrientation(imagick::ORIENTATION_TOPLEFT); + return TRUE; + } // based off comment on http://php.net/manual/en/function.imagerotate.php if(!$this->is_valid()) @@ -995,3 +1013,4 @@ function store_photo($a, $uid, $imagedata = "", $url = "") { return($image); } +