It seems most people rather keep the exif data, and have trouble keeping it. I have the opposite problem - we have a profile picture upload and it keeps the exif data. I'd like to strip that off the images. Is there a way to actively do that?
You can do this by implementing
This hook is called when a file has been added to the database. The hook doesn't distinguish between files created as a result of a copy or those created by an upload.
In this hook, you need to:
- Test if file is really an image. I suggest using mimetype for this task:
- Recognize which image processing library your Drupal is using. See
- Process that file. This part is general programming issue already well answered on Stack Overflow - I see no point in reposting it here, I think I covered Drupal part of the question now.
Now, it looks like the easiest way to do this is with File metadata manager (Drupal 8 and above). It has a submodule file_mdm_exif, which allows you to read and write EXIF information for JPEF and TIFF images.
You would still need to add some custom code to automatically remove EXIF data before saving.