1

I have an issue with Magento 2.4.4 upload Photo. as you can see after uploading a picture there is a rotation of the image. I did a quick search and found that this problem comes when a photo is uploaded with iPhone and EXIF data. I already tried following the code in uploader.php. but, did not work. please check the code and SS. does anyone got the same issue?

 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']);
            }

enter image description here enter image description here

1 Answer 1

1

IN this file vendor\magento\framework\File\Uploader.php

this code use :

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 Line

$this->_result = $this->_moveFile($this->_file['tmp_name'], $destinationFile);
5
  • I already placed that code. Can you confirm that is correct in following way? ibb.co/zS4kKX6 Jul 20, 2022 at 13:07
  • yes, it is currect Jul 20, 2022 at 13:09
  • okay if not works can be a cache issue? i have to run php bin/magento setup:static-content:deploy ? Jul 20, 2022 at 17:31
  • yes check it it is working ? Jul 21, 2022 at 7:07
  • Ping you asap :) Can you confirm i have to run setup:static-content:deploy ? Jul 25, 2022 at 19:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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