Metadata is information about an image, and can be included in JPEG image files.

EXIF metadata is information about the image recorded directly from the camera – for example, the exposure time and the date the photo was taken.

WordPress preserves EXIF information in full size images loaded to your website. It will also extract the Exif data to make it available for plugin developers.

When WordPress uploads images, in addition to uploading the Full Size image it automatically creates several differently sized versions of the image. By default: a Large, Medium and Thumbnail version.

The problem is that Wordpress is stripping the EXIF data when resizing images. The resized images become "orphan".

An "orphan" work is a work to which copyright cannot be determined or a work where the determined copyright holder cannot be contacted.

In the era of responsive images, it cannot be that the solution to keep the EXIF data of an image is to use the image in full-size.

Question:

  • How to force Wordpress to keep EXIF data?

Digging further:

  • Is there a way to insert the EXIF data in resized images once they have been resized?
  • Is there a way to force wordpress to use another Image Processing System that is not stripping metadata from images?

This issue has been fixed with a filter in Wordpress 4.5. If you want to preserve the exif data when resizing use

add_filter ('image_strip_meta', false);
  • applies only to imagick and not GD image processing PHP libraries, so not a general solution – Mark Kaplun Sep 12 '16 at 13:36
  • Or any other image library that you might want to install, but given that Imagick is the WP standard this will work for most people. – cjbj Sep 12 '16 at 13:54
  • I thought that GD was a standard for a long time which means that you will find it in many shared hostings. So depends on what is it that you want to do, one off solution or a general use plugin/theme – Mark Kaplun Sep 12 '16 at 13:55
  • Yes, a general solution would include a script that fixes GD on this – cjbj Sep 12 '16 at 14:18

1) How to force Wordpress to keep EXIF data?

Use imagick instead of GD. If imagick is installed in your server, wordpress will use it instead of GD. Problem is, that many servers and shared hostings dont have imagick and the user has to install it, which can be a hassle. Many shared hostings don't even allow to install other php extensions. Some hostings provide imagick by default. It's always a great idea to check if the hosting has it (and if not, if its possible to install it) before attempting to build a website that will require such metadata.

Last time I did a project that required EXIF, my client had a server that didnt allow the installation of imagick. We migrated server, installed imagick and solved the issue.

There is an important note concerning regenerate thumbnails plugins: even if you have imagick installed in your server, some of these plugins will remove the metadata when regenerating images. Carefully read each plugin description and make sure they dont remove metadata before using them.


2) Is there a way to insert the EXIF data in resized images once they have been resized?

This metadata is stored in db tables, but why would you attempt to do that if you can keep the metadata using imagick?


3) Is there a way to force wordpress to use another Image Processing System that is not stripping metadata from images?

Yes, imagick.

The work around is to simply download the images created by Wordpress to your computer, add the metadata with a program like Photoshop, and the upload them to the same folder, replacing the originals with the one now containing the metadata. It's not that convenient, but doesn't require any knowledge other than how to download files (I use FTP) and how to add metadata.

You won't be able to add back camera data, but you can add copyright information, credit information, and who to contact in order to get permission to use the photos.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.