I'm developing an PHP web-app with the ability to upload pictures. In the controller, I set the rotation like this:
$exif = exif_read_data($config['source_image']);
if($exif && isset($exif['Orientation']))
{
$ort = $exif['Orientation'];
if ($ort == 6 || $ort == 5)
$config['rotation_angle'] = '270';
if ($ort == 3 || $ort == 4)
$config['rotation_angle'] = '180';
if ($ort == 8 || $ort == 7)
$config['rotation_angle'] = '90';
if ($ort == 1 || $ort == 2)
$config['rotation_angle'] = '0';
}
$this->image_lib->initialize($config);
if ( ! $this->image_lib->rotate())
{
echo $this->image_lib->display_errors();
}
This works fine when images are uploaded from an iOS device, but has no effect with Android. Thank you for your suggestions in advance.