Skip to content

Imagemagick Call to undefined function exec() - exec is often disabled. #5383

Open

Description

@robinsowell

Same issue with NetPBM.

We do use exec() in maybe 10 spots in the code, but mostly with a conditional to fall back to if it's not available. And it is often disabled. And the docs don't note it as a required php extension.

At the least, we don't want to throw php errors and it would be nice to have a fallback when it's not available.

Both integrations are in:

system/ee/legacy/libraries/Image_lib.php

  • image_process_imagemagick() begins around line 525 and calls exec() around line 569.
  • image_process_netpbm() begins around line 593 and calls exec() around line 654.

The class already uses the Imagick extension for strip_metadata(), but not for resizing, cropping, or rotation.

I'm not spotting an alternative for NetPBM, but Imagmagick could fall back to the extension.

HOWEVER research suggests that there are some differences in performance between the two options. So I'm not just dropping in a pr now adding it as a fallback.

The Imagick extension may produce slightly different output than the CLI. Testing should cover resize, crop, rotation, JPEG quality, PNG transparency, and GIF handling.

Existing CLI-configured installations should continue using the CLI backend. NetPBM behavior should remain unchanged when exec() is available.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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