I am using codazon theme for Magento 2 and I am facing issue when I open Magento 2 admin from iPhone and start adding images for product all of sudden the images change to landscape, all other places working fine from laptop browser, android, everything working fine but when adding from iPhone the image change to landscape. need help


if you edit photo in IPhone before upload, it will solve you problem or use below code to rotate all IPhone JPEG images (direct from camera or default) to fix it.

go to vendor\magento\framework\File\Uploader.php on line 228, inside try block add

if ((strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'],'iPad')) && exif_imagetype($this->_file['tmp_name']) == IMAGETYPE_JPEG) {
            $source = imagecreatefromjpeg($this->_file['tmp_name']);
            $rotate = imagerotate($source, 270, 0);
            imagejpeg($rotate, $this->_file['tmp_name']);

before $this->_result = $this->_moveFile($this->_file['tmp_name'], $destinationFile); line

this is not a proper solution, but it might solve your problem.

  • Awesome Than you so much @Ibrar its really help me, the bug is fixed :) Thank you so much once again. – Asif Jalil Sep 15 '19 at 9:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.