Ok.. now I have been trying this for long time now.
I am trying to rotate image if it has some orientation . I got reference from Here
I also refered this
Here is function I am using
function adjustPicOrientation($full_filename){
$exif = exif_read_data($full_filename);
if($exif && isset($exif['Orientation'])) {
$orientation = $exif['Orientation'];
if($orientation != 1){
$img = imagecreatefromjpeg($full_filename);
$mirror = false;
$deg = 0;
switch ($orientation) {
case 2:
$mirror = true;
break;
case 3:
$deg = 180;
break;
case 4:
$deg = 180;
$mirror = true;
break;
case 5:
$deg = 270;
$mirror = true;
break;
case 6:
$deg = 270;
break;
case 7:
$deg = 90;
$mirror = true;
break;
case 8:
$deg = 90;
break;
}
if ($deg) $img = imagerotate($img, $deg, 0);
$full_filename = str_replace('.jpg', "-O$orientation.jpg", $full_filename);
imagejpeg($img, $full_filename, 95);
}
}
return $full_filename;
}
A new image with new name is getting saved but there is no rotation change.
Actually I am facing very unexpected issue .. when I rotate image with static rotation angle it is working fine .. but it is not working for the rotation angles mentioned in conditions .. I am no able to figure it out ...
Can I body suggest me what went wrong .. Any help will be appreciated
Thanks