0

the photo before loading in the preview is correct, but on the server it is already saved sideways

Image save code:

public function postUploadImage($path, $id) {
        $img = new Imagick($path);
        $profiles = $img->getImageProfiles("icc", true);
        $img->stripImage();
        if(!empty($profiles))
            $img->profileImage("icc", $profiles['icc']);
        $img->cropThumbnailImage(500, 500);
        $img->setImageCompressionQuality(80);
        $img->writeImage($_SERVER['DOCUMENT_ROOT']  . '/public/materials/'.$id.'.jpg');
        $img->clear();
    }

I kind of understand that the problem is EXIF, but how to get rid of them if stripImage () does not work

Thanks for wathing!

If i try used var_dump(exif_read_data($path)); he return

array(7) {
  ["FileName"]=>
  string(9) "phpv0IOKS"
  ["FileDateTime"]=>
  int(1615462769)
  ["FileSize"]=>
  int(99279)
  ["FileType"]=>
  int(2)
  ["MimeType"]=>
  string(10) "image/jpeg"
  ["SectionsFound"]=>
  string(0) ""
  ["COMPUTED"]=>
  array(4) {
    ["html"]=>
    string(24) "width="960" height="540""
    ["Height"]=>
    int(540)
    ["Width"]=>
    int(960)
    ["IsColor"]=>
    int(1)
  }
}
Danzo Sama
  • 47
  • 5

0 Answers0