CodeIgniter Forums
getExif Error Ci4 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: getExif Error Ci4 (/showthread.php?tid=76417)



getExif Error Ci4 - 68thorby68 - 05-11-2020

Using CI4 I have created a very simple test script, to read the exif data of an image uploaded via ajax post. All works OK if image has exif data, but if the image does NOT contain exif data the script just fails, rather than respect the else statement. Any ideas ????

PHP Code:
if($this->request->isAJAX()) {            
            
helper(['form''url']);
            
$request = \Config\Services::request();
            
$validation =  \Config\Services::validation();            
            
            
$file $this->request->getFile('image');
            
            
$image  = \Config\Services::image()
                        ->
withFile($file);
            
            if(!
$image->getExif($file)){
                
$error_message=array('error'=>'NO EXIF');
                    return 
json_encode($error_message);
                    exit;
            }else{
                
$error_message=array('error'=>'Has EXIF');
                    return 
json_encode($error_message);
                    exit;
            }
        } 



RE: getExif Error Ci4 - paulbalandan - 08-30-2020

@68thorby68, are you still having this issue?


RE: getExif Error Ci4 - 68thorby68 - 08-31-2020

Hi,

I'm not sure as wrote my own script and dont use this function.

I'll try this out later for you, but as I'm having issues installing the latest version of Ci4 (see https://forum.codeigniter.com/thread-77217-page-2.html), testing may be futile.

Many thanks for following up.


RE: getExif Error Ci4 - paulbalandan - 08-31-2020

I made a fix for exif read data throwing an exception. Try using the latest develop version.