CodeIgniter Forums
getEXIF error on some files...bug? - 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 on some files...bug? (/showthread.php?tid=74573)



getEXIF error on some files...bug? - derekt - 10-10-2019

Almost put in a bug in GitHub, but wanted to post here first and see if it's valid:



- OS: MacOS 10.14.6

- Web server Apache/2.2.34 (local)

- PHP version 7.3.7

- CodeIgniter 4.0.0-rc.2



My Controller Code:



Code:
$image = \Config\Services::image();
$exif = $image
->withFile(WRITEPATH.'uploads/'.$newName)
->getEXIF();




Expecting the getEXIF function to return the results of exif_read_data, which it does for some files but on others the following error was logged:



CRITICAL - 2019-10-09 02:02:51 --> exif_read_data(my-jpg.jpg): Incorrect APP1 Exif Identifier Code

#0 [internal function]: CodeIgniter\Debug\Exceptions->errorHandler(2, 'exif_read_data(...', '/Directory/...', 544, Array)

#1 /Directory/framework-master/system/Images/Handlers/BaseHandler.php(544): exif_read_data('/MyFolder/...')

#2 /MyFolder/framework-master/app/Controllers/Images.php(55): CodeIgniter\Images\Handlers\BaseHandler->getEXIF()

#3 /MyFolder/framework-master/system/CodeIgniter.php(844): App\Controllers\Images->upload()

#4 /MyFolder/framework-master/system/CodeIgniter.php(335): CodeIgniter\CodeIgniter->runController(Object(App\Controllers\Images))

#5 /MyFolder/framework-master/system/CodeIgniter.php(245): CodeIgniter\CodeIgniter->handleRequest(NULL, Object(Config\Cache), false)

#6 /MyFolder/framework-master/public/index.php(45): CodeIgniter\CodeIgniter->run()

#7 {main}



I can provide it if needed.



Will be happy to file the bug in GitHub if appropriate.



Thanks,

Derek


RE: getEXIF error on some files...bug? - ciadmin - 10-10-2019

EXIF is not supported on GIF files - we made a change for that 3 weeks ago ... https://github.com/codeigniter4/CodeIgniter4/pull/2246

It looks like you are trying to retrieve the info for a JPEG (my-jpg.jpg) - is that correct? If so, is the JPEG properly encoded?


RE: getEXIF error on some files...bug? - derekt - 10-10-2019

Thanks for the quick reply!

The file is a JPEG and I'm honestly not positive about how to check the encoding, but I ran this in terminal (note it's a different test file):

file -I /Mypath/_DSC_0047_34657.jpg
/Mypath/_DSC_0047_34657.jpg: image/jpeg; charset=binary