This makes sure we reorient images with orientation info from iOS before
we strip them.
die('Upload error');
}
$size = $images['size'][$i];
die('Upload error');
}
$size = $images['size'][$i];
+
+ // imagemagick manip code
$img = new Imagick($tmp_file);
$img = new Imagick($tmp_file);
- // keep ICC for quality
+ // no compression
+ $img->setImageCompressionQuality(100);
$profiles = $img->getImageProfiles("icc", true);
$profiles = $img->getImageProfiles("icc", true);
+ $exif_orientation = $img->getImageOrientation();
+
+ // STRIP EXIF DATA
+
+ // REAPPLY EXIF DATA
+ if($exif_orientation === imagick::ORIENTATION_BOTTOMRIGHT) {
+ $img->rotateImage("#000", 180);
+ } elseif ($exif_orientation === imagick::ORIENTATION_RIGHTTOP) {
+ $img->rotateImage("#000", 90);
+ } elseif ($exif_orientation === imagick::ORIENTATION_LEFTBOTTOM) {
+ $img->rotateImage("#000", -90);
+ }
+ $img->setImageOrientation(imagick::ORIENTATION_TOPLEFT);
+ // keep ICC for quality
$img->profileImage('icc', $profiles['icc']);
}
$img->profileImage('icc', $profiles['icc']);
}