0

これを回避する方法を見つけるのに本当に苦労しています...

iPhone で縦向きに撮影した画像をアップロードすると、EXIF の向きのために回転されます。

このデータを取得しようとしましたが、使用すると削除されます:

imagecreatefromstring();

EXIFデータを削除せずに画像をアップロードする正しい方法/方法を探しています。

現在、これは次のとおりです。

$imagefile = $fileToUpload["tmp_name"];
$destinationImage = imagecreatefromstring(file_get_contents($imagefile));
$exif = exif_read_data($imagefile);
$moveUploadedFile = imagejpeg($destinationImage, $this->uploadDir . "/" . $newFileName, 100);
imagedestroy($destinationImage);

if ($moveUploadedFile) {
  $return['ort'] = $exif;
  echo json_encode($return);
}

ありがとう。

4

0 に答える 0