File "index.php"
Full path: /home/meharicl/www/imagick/index.php
File
size: 1.46 B
MIME-type: text/html
Charset: utf-8
Download Open Edit Advanced Editor Back
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Sans Titre</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<meta name="generator" content="HAPedit 3.1">
</head>
<body bgcolor="#FFFFFF">
<?php
// Your code here
echo "<hr />\n".
"HAPedit 3.1.11.111 (juillet 2019 17:09:54)********************";
$image = new Imagick('Img_3.jpg');
//$image->rotateimage("#000", 180); // rotate 180 degrees
autoRotateImage($image);
echo($orientation = $image->getImageOrientation()."****");
// - Do other stuff to the image here -
$image->writeImage('result-image.jpg');
function autoRotateImage($image) {
$orientation = $image->getImageOrientation();
switch($orientation) {
case imagick::ORIENTATION_BOTTOMRIGHT:
$image->rotateimage("#000", 180); // rotate 180 degrees
break;
case imagick::ORIENTATION_RIGHTTOP:
$image->rotateimage("#000", 90); // rotate 90 degrees CW
break;
case imagick::ORIENTATION_LEFTBOTTOM:
$image->rotateimage("#000", -90); // rotate 90 degrees CCW
break;
}
$image->rotateimage("#000", 180);
// Now that it's auto-rotated, make sure the EXIF data is correct in case the EXIF gets saved with the image!
$image->setImageOrientation(imagick::ORIENTATION_TOPLEFT);
}
?>
</body>
</html>