webP errors

12 posts by 3 authors in: Forums > CMS Builder
Last Post: November 30   (RSS)

By rez - November 13

Trying the latest version.  Is this a server issue or...

Unable to set image format
in /home/mong/public_html/cmsb/lib/image_functions.php on line 401. Call to undefined function imagecreatefromwebp()
in /home/mong/public_html/cmsb/lib/image_functions.php on line 40. Unable to set image format
in /home/mong/public_html/cmsb/lib/image_functions.php on line 401. Unable to set image format
in /home/mong/public_html/cmsb/lib/image_functions.php on line 401.

By rez - November 13

Oh no... I unchecked the webP option and I am still getting the error as if CMSB is still trying to convert. 

I can't upload any photos.

Call to undefined function imagecreatefromwebp()
in /home/mong/public_html/cmsb/lib/image_functions.php on line 40.

By rez - November 13 - edited: November 13

Update: although I had the option to convert to WebP turned back off, I still had webP as an upload option and was trying to upload a webP image.

I removed that file type from the upload filed possibilities and uploading jps are working.

I am not converting and I'm not sure if I am supposed to be able to at least upload and use webP? I would think so. This is the first time I have tried.

Please advise.

...unless it was still trying to convert because of a cache situation. I need this site done tonight so no more experimenting from me for now! 

By Michael - November 15

Hi rez,

The allowed file extensions are defined per upload field in the section editors/schema files so even though you turned off the "Use WebP" setting, the .webp file extension would still be listed as an allowed upload type and you'd still be able to select and upload .webp files (or any other allowed file extension).

Can you tell me a bit about your server environment?  OS, PHP version, etc.  It's possible your server doesn't have WebP support enabled.  You can verify this by checking the output of the phpinfo() function.  You should see WebP Support enabled screenshot attached.

Michael Sams
Programmer
interactivetools.com
Attachments:

gd-settings-screen.jpg 92K

By pault - November 24

Hi Michael,

I'm also getting this error.  I'm trying to upload a jpg image with the option to 'Automatically convert image uploads to WebP format' selected.

I've checked phpinfo() and get the same as your screenshot, WebP support is enabled.

OS is CentOS 7.9.2009, PHP is v8.0.13.

Regards, Paul.

By pault - November 29

Hi Michael,

Thanks for your reply.

So the first point returns 'imagecreatefromwebp() is available'

I've created the section with upload field, unchecked all of the options and ensured WebP is turned on and get the same error message as before:

Unable to set image format
in httpdocs/cmsAdmin/lib/image_functions.php on line 401.

Regards, Paul.

By Michael - November 29

Hi Paul,

Can you check the Imagick section on the phpinfo() output to see if WebP is listed there?  I've attached a sample output of what we're looking for here.

Thanks,

Michael

Michael Sams
Programmer
interactivetools.com

By pault - November 29

Hi Michael,

WEBP isn't listed there.  Is it possible to get CMS Builder to use GD instead of ImageMagick?  Or do you think there's another workaround?

Thanks, Paul.

By Michael - November 29

Hi Paul,

In your particular case it looks like ImageMagick is not configured with WebP support.

I would start by requesting that your hosting provider add WebP support to the ImageMagick configuration on your server.

We will be releasing a patch/update to check for this scenario but in the mean time if you're comfortable editing CMSB's files you can patch this issue yourself very easily following the steps below.

  1. Save a backup copy of the /lib/image_functions.php file.
  2. Open the /lib/image_functions.php file in a text editor or your favorite IDE.
  3. Search for this line (around line #394):
    if(extension_loaded('imagick') and $extension != 'gd') {​
  4. Replace that line with this:
    if(extension_loaded('imagick') and $extension != 'gd' and in_array('WEBP', \Imagick::queryformats())) {​

This will add an additional check for WebP support specifically and in your case should result in the script falling back to using the GD library to handle the conversion.

Thanks,

Michael

Michael Sams
Programmer
interactivetools.com