5

Im developing a panel in which Im uploading a jpg, it copies it, resizes it, saves another jpg and now I want also to be able to create a copy but using webp extension.

Ive checked everywhere and couldnt find anyone with the same problem. Im running cPanel on CentOS cPanel > Version: ImageMagick 6.9.10-68 Q16 x86_64 2020-04-01

$imagick = new \Imagick($targetJpg); 
$imagick->writeImage('webp:'.$targetWebp);

I was getting this error

Fatal error: Uncaught ImagickException: delegate failed `'cwebp' -quiet %Q '%i' -o '%o'' @ error/delegate.c/InvokeDelegate/1928 in /...dirs.../pic-upload.php:108 Stack trace: #0 /...dirs.../pic-upload.php(108): Imagick->writeimage('webp:../images/...') #1

=========================================================

In my local machine, OSX, using Mamp, that was solved with @MarkSetchell help.

On OSX > Terminal type: cwebp -version webp 1.1.0

type: type cwebp cwebp is hashed (/usr/local/bin/cwebp)

Marks solution > Worked! :) On macOS, your cwebp seems to be the homebrew one in /usr/local/bin, so I would suggest you find your Imagick config file called delegates.xml and edit it so that where it says 'cwebp' -quiet -q %Q '%I'... it becomes '/usr/local/bin/cwebp' -quiet -q...

=========================================================

In CentOS cPanel

Neither cwebp or dwebp was installed. This was due to the package libwebp-tools not being installed.

I installed them and checked - results: [root@server:/]$ whereis cwebp cwebp: /usr/bin/cwebp /usr/share/man/man1/cwebp.1.gz [root@server:/]$ whereis dwebp dwebp: /usr/bin/dwebp /usr/share/man/man1/dwebp.1.gz

Everything working now! Hope this is useful for someone else. Thanks for the Mark and Chris for the help

General Grievance
  • 4,555
  • 31
  • 31
  • 45
BachuArg
  • 71
  • 1
  • 3
  • What version of Imagick do you have? – Chris Haas May 13 '20 at 13:22
  • 1
    Have you got `webp` installed on your Mac with `brew install webp`? Please also paste output of `cwebp -version` and `type cwebp` – Mark Setchell May 13 '20 at 13:29
  • @ChrisHaas in cPanel> Version: ImageMagick 6.9.10-68 Q16 x86_64 2020-04-01 – BachuArg May 13 '20 at 14:55
  • @MarkSetchell $ cwebp -version 1.1.0 $ cwebp Usage: cwebp [options] -q quality input.png -o output.webp where quality is between 0 (poor) to 100 (very good). Typical value is around 80. Try -longhelp for an exhaustive list of advanced options. – BachuArg May 13 '20 at 14:56
  • Please click `edit` under your answer and include the output from `type cwebp` and also the output from `identify -list delegate` – Mark Setchell May 13 '20 at 15:13
  • 2
    I don't understand why you have mixed up macOS and CentOS stuff in the same question, but I think PHP Imagick is unable to find your `cwebp` program. On macOS at least, your `cwebp` seems to be the **homebrew** one in `/usr/local/bin`, so I would suggest you find your Imagick config file called `delegates.xml` and edit it so that where it says `'cwebp' -quiet -q %Q '%I'...` it becomes `'/usr/local/bin/cwebp' -quiet -q...` – Mark Setchell May 13 '20 at 15:28
  • @MarkSetchell - I need to solve the issue in CentOS and OSX because Im developing a website, that I need to test and be able to run on my computer, using mamp, and also need to be able to upload it to my server, using cPanel and centos. - Your answer solved the OSX and mamp issue. Thanks! – BachuArg May 13 '20 at 15:40

0 Answers0