Skip to content

Expose Intervention/Image strip option in Glide for consistent EXIF handling #445

@marc31

Description

@marc31

Description

Hi,

Glide uses Intervention/Image internally to process images, which itself relies on either GD or Imagick.

I noticed an inconsistency in EXIF metadata handling depending on the driver used.

Current behavior

  • GD (via Intervention/Image)
    EXIF metadata are always stripped, with no way to keep them.
  • Imagick (via Intervention/Image)
    • If the strip option is not provided, all EXIF metadata are preserved
    • If strip = true, Intervention/Image removes EXIF metadata while keeping color profiles

This means that simply switching the driver from GD to Imagick can unexpectedly reintroduce EXIF metadata.

Problem

Glide currently does not expose or forward the strip parameter to Intervention/Image.
As a result, users cannot explicitly request EXIF stripping when using the Imagick driver, even though Intervention/Image already supports this behavior.

Expected / suggested behavior

Glide should allow passing a strip parameter to Intervention/Image so users can control metadata handling consistently across drivers.

This would:

  • Enable EXIF stripping with Imagick
  • Preserve color profiles when stripping metadata
  • Reduce behavioral differences between GD and Imagick

Proposed implementation

Intervention/Image already supports a strip option for Imagick encoders.
Glide only needs to forward the strip parameter from request parameters to the encoder options.

In src/Api/Encoder.php, inside the run() method, Glide could map the request parameter to Intervention/Image:

if ($this->params['strip'] ?? false) {
    $encoderOptions['strip'] = true;
}

This does not add new image-processing logic to Glide; it simply exposes an existing Intervention/Image feature.

Related note

More generally, I think it could also make sense to open a PR on Intervention/Image itself to further uniformize the default behavior between GD and Imagick, so metadata handling is consistent regardless of the underlying driver (cf Intervention/image#1471).

I’d be happy to open a PR if this change sounds acceptable 🙂

Thanks for your work on Glide!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions