ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: TomD on April 14, 2024, 06:50:51 PM

Title: Faster alternatives vs. using exiftool to check lat/lon metadata
Post by: TomD on April 14, 2024, 06:50:51 PM
Hi, I'm planning to use exiftool to strip GPS lat/lon from image uploads, based on user preference.  Basically if a user uploads an image with GPS coordinates, it alerts them and gives them the option to strip location before submitting their post.  To speed up the check while processing the upload in php, I'm considering using the inbuilt php functions to check for GPSLatitude or GPSLongitude EXIF tags, as well as the XMP block for <*GPSL*> as that takes ~0.001 seconds in php vs. ~0.2 seconds shelling out to exiftool from php.  Thoughts?  Is what I'm doing in php equivalent to checking for GPSL* with exiftool?  Or should I be checking for more stuff in the XMP?  I'm not that familiar with XMP tags, thanks!
Title: Re: Faster alternatives vs. using exiftool to check lat/lon metadata
Post by: Phil Harvey on April 14, 2024, 09:30:17 PM
What format files are being uploaded?

- Phil
Title: Re: Faster alternatives vs. using exiftool to check lat/lon metadata
Post by: TomD on April 14, 2024, 09:56:06 PM
Any image format can be uploaded, but if the mime type is not gif, jpeg or png it gets converted to jpeg.  So pretty much only need to worry about jpeg or png.  For png I would leverage exiftool regardless as php can't read exif for png.
Title: Re: Faster alternatives vs. using exiftool to check lat/lon metadata
Post by: Phil Harvey on April 15, 2024, 06:45:59 AM
OK then.  For JPEG your idea of looking for EXIF GPS tags and doing a brute force search for GPS in the XMP should work for most cases.  In XMP, you might want to qualify it with the namespace prefix and search for "exif:GPSL".

- Phil
Title: Re: Faster alternatives vs. using exiftool to check lat/lon metadata
Post by: TomD on April 16, 2024, 03:51:08 PM
Thanks!  One more question, would the XMP always have the exif: prefix before GPS?  Also, do I need to worry about case or will it always be lowercase exif: followed by uppercase GPSL in the XMP for the Lat/Lon tags?
Title: Re: Faster alternatives vs. using exiftool to check lat/lon metadata
Post by: Phil Harvey on April 16, 2024, 05:00:01 PM
I've never seen anything but a lower-case "exif" for the namespace prefix, but technically anything is possible.

- Phil