From 3ed5f41f1fa4bc2f9c664913da3d87956f318bac Mon Sep 17 00:00:00 2001 From: Darko Date: Fri, 5 Jul 2019 22:46:06 +0200 Subject: [PATCH 1/2] autoRotate() fix double rotation when using ajax image upload https://forums.osclass.org/general-help/image-rotation-issue-when-using-imagemagick/ (committing to master since other branches are out of sync) --- oc-includes/osclass/controller/ajax.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/oc-includes/osclass/controller/ajax.php b/oc-includes/osclass/controller/ajax.php index a1f380be43..18598ad4da 100755 --- a/oc-includes/osclass/controller/ajax.php +++ b/oc-includes/osclass/controller/ajax.php @@ -298,6 +298,7 @@ function doModel() try { $img = ImageProcessing::fromFile(osc_content_path() . 'uploads/temp/' . $filename); $img->autoRotate(); + $img->resetOrientation(); $img->saveToFile(osc_content_path() . 'uploads/temp/auto_' . $filename, $original['extension']); $img->saveToFile(osc_content_path() . 'uploads/temp/' . $filename, $original['extension']); @@ -345,4 +346,4 @@ function doView($file) } /* file end: ./ajax.php */ -?> \ No newline at end of file +?> From a8310e0e78295946459941143a97c60d42aa3360 Mon Sep 17 00:00:00 2001 From: Darko Date: Fri, 5 Jul 2019 22:47:43 +0200 Subject: [PATCH 2/2] autoRotate() fix double rotation when using ajax image upload --- oc-includes/osclass/classes/ImageProcessing.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/oc-includes/osclass/classes/ImageProcessing.php b/oc-includes/osclass/classes/ImageProcessing.php index 78fde91621..0bd96896c2 100755 --- a/oc-includes/osclass/classes/ImageProcessing.php +++ b/oc-includes/osclass/classes/ImageProcessing.php @@ -214,6 +214,14 @@ public function saveToFile($imagePath, $ext = null) { } } + public function resetOrientation() { + if($this->_use_imagick) { + $this->im->setImageOrientation(1); + } else { + $this->_exif['Orientation'] = 1; + } + } + public function autoRotate() { if($this->_use_imagick) { switch($this->im->getImageOrientation()) {