Drupal is a registered trademark of Dries Buytaert

exif_removal

44 sites Security covered
View on drupal.org

EXIF Removal is a privacy-focused Drupal module that automatically strips sensitive metadata from uploaded images. It protects user privacy by removing GPS locations, device information, and timestamps that could potentially expose personal information.

The module works silently in the background during the file upload process. When users upload images through any Drupal form (content creation, user pictures, media library, etc.), the module intercepts the upload, processes the image to remove sensitive metadata, and then allows the upload to complete normally.

It uses GD and imagejpeg() to create a new copy of the image, imagejpeg() will reencode the image, we use the quality value 80 because the comment from PHP page https://www.php.net/manual/en/function.imagejpeg.php#76780

I did an experiment with the image quality parameter of the imagejpeg() function when creating jpegs. I found the optimal image quality with file size is taken into account to be 80 - very close to the default value of 75.

Anything over 80 results in an unnecessary increase in file size without much increase in image quality.

      // Remove all EXIF data from the image.
      if ($file->getMimeType() == 'image/jpeg') {
        // Use GD to strip all EXIF data by re-saving the image.
        $image_resource = @imagecreatefromjpeg($path);
        if (!$image_resource) {
          // Failed to create image resource.
          return FALSE;
        }

        // Create a new image without EXIF data.
        imagejpeg($image_resource, $path, 80);
        imagedestroy($image_resource);

        return TRUE;
      }

It also supports imagemagick if image_effects is installed.

      $image = $this->imageFactory->get($file->getFileUri());
      if ($this->moduleHandler->moduleExists('image_effects')
        && $image->getToolkit()->getPluginId() == 'imagemagick') {
        $toolkit = $image->getToolkit();
        if ($toolkit->apply('strip')) {
          $image->save();
        }
      }

Activity

Total releases
6
First release
Mar 2025
Latest release
11 months ago
Release cadence
3 days
Stability
17% stable

Release Timeline

Releases

Version Type Release date
1.0.0 Stable Mar 26, 2025
1.0.0-beta4 Pre-release Mar 18, 2025
1.0.0-beta3 Pre-release Mar 13, 2025
1.0.0-beta2 Pre-release Mar 13, 2025
1.0.0-beta1 Pre-release Mar 12, 2025
1.0.x-dev Dev Mar 12, 2025