Search code examples
phpjpegimagickwebp

PHP new Imagick('image.webp') not working


I have a sneaking suspicion that the reason why my local works when I call:

$image = new Imagick($image_source);
  • where $image_source is a webp image

versus when I use the same call and image format type in my staging environment is due to the difference of a combination of my local apache php & imagick versions and staging versions.

Local

PHP:

PHP 7.2.34 (cli) (built: Dec 11 2020 10:51:16) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies

imagick:

imagick module version => 3.7.0
Imagick compiled with ImageMagick version => ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org
Imagick using ImageMagick library version => ImageMagick 6.9.10-23 Q16 x86_64 20190101 https://imagemagick.org

Staging

PHP:

PHP 5.6.40 (cli) (built: Oct 28 2021 14:48:10) 
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
    with the ionCube PHP Loader (enabled) + Intrusion Protection from ioncube24.com (unconfigured) v5.1.1, Copyright (c) 2002-2016, by ionCube Ltd.
    with Zend Guard Loader v3.3, Copyright (c) 1998-2014, by Zend Technologies
    with Zend OPcache v7.0.4-dev, Copyright (c) 1999-2015, by Zend Technologies

imagick:

imagick module version => 3.4.3
Imagick compiled with ImageMagick version => ImageMagick 6.9.4-1 Q16 x86_64 2016-10-13 http://www.imagemagick.org
Imagick using ImageMagick library version => ImageMagick 6.9.4-1 Q16 x86_64 2016-10-13 http://www.imagemagick.org

When I call new Imagick($image_source); in my staging environment, I'm noticing that it stops on that line and that line only without returning anything for $image.

Can anyone put my suspicions to rest here? I've exhausted my troubleshooting and rabbit hole-ing. Thank you!


Solution

  • Imagick webp was added in 3.4.4

    See https://pecl.php.net/package-info.php?package=imagick&version=3.4.4