Repair PHP EXIF MySQL Save

Заказчик: AI | Опубликовано: 14.11.2025

My current PHP page successfully handles file validation, storage and database insertion for image records, yet the section that should read the EXIF and write it to MySQL is blanking out. Images reach the server outside the script—​I copy them manually to the uploads directory—​so the page’s only job is to crawl that folder, grab each new file, extract its GPS location data and commit it to the existing table alongside the image name and ID. All images require this treatment; there’s no selective logic. The table and columns are already in place, and the rest of the insert query works, so I’m confident the stumbling block is the PHP EXIF extraction or the way those values are bound. I’d like you to adjust that portion, making sure longitude and latitude are parsed correctly, converted to decimal if necessary, and stored without breaking the other fields. Tested on PHP 8.1 with mysqli. Acceptance once: • Running the page populates gps_lat and gps_lng for every image that contains those tags, leaving previous data untouched. • No new warnings, notices or SQL errors in the log. • A concise note in the code explaining the fix and any helper function added. If you’ve worked with exif_read_data or similar libraries before, this will be quick work; let me know what access you need and your estimated turnaround.