WordPress remove EXIF Data from specific Thumb

Assuming you are using ImageMagick (the WP standard) as your library there is a filter called image_strip_meta which controls whether the EXIF data must be preserved. Normally you would just use a boolean to do an overall setting, but you could easily make that a function like this:

add_filter ('image_strip_meta','wpse239481_conditional_strip')

function wpse239481_conditional_strip {
  if (...condition ..) return true else return false;
  }

The problem is in the condition. You would need to access the current thumbnail label, which doesn’t trickle down from the multi_resize method that sets thing going. However, the target width and height are known in the resize function where the filter resides. Still, you can’t access those dimensions inside the filter unless you hack the core to make this instance of apply_filters pass parameters.

Unless of course, someone smarter than me knows a trick.

Leave a Comment