0

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.

AB Moslih
  • 45
  • 1
  • 9
  • Is there an error message from the line `echo $this->image_lib->display_errors()` (where you previously had the comment "Error messages here")? If so, can you add it to your post? – Jonathan Lam May 17 '18 at 01:22
  • Hi @JonathanLam ! No, there is no error message. It just uploads the image without rotating it – AB Moslih May 17 '18 at 01:23
  • I think there is no exif information in android images your have uploaded. Check this – Vlad May 17 '18 at 03:47
  • What is the effect you are after? And why is it that you mess around with exif rotation? – greenapps May 17 '18 at 07:36

0 Answers0