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
1 Answer
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– Asif Jalil2019-09-15 09:07:27 +00:00Commented Sep 15, 2019 at 9:07