Question regarding limitations of WebP function in CMSB

9 posts by 2 authors in: Forums > CMS Builder
Last Post: September 20, 2022   (RSS)

By Codee - September 2, 2022

Hello IT,

So my client may have stumpled upon an issue with the automated webp converter.  He kept getting an error on larger files BUT he WAS having some Internet speed issues so I explained that during uploads, if the connection halts for a moment or can't handle the number of packets running through then that could easily cause a problem during uploads.  However, he took my advice and tried uploading from two separate distinct locations...30miles and different ISPs.  He kept running into the same problem.  So I ran some tests.  He is correct.  I've narrowed down the issue quite a bit.  

The system errors on the uploads when uploading .png files somewhere between 10-20 mb file size.  I realize that's larger than 'normal' but we have some specific use cases. If I turn the automatic webp converter off (uncheck the box) then the same files that failed had no problem uploading and showing. So the challenge seems to be with larger file sizes that are being converted to webp.  It may be the package the hosting company is utilizing or it may be that the webp converter simply can't handle files that large.

Does any one here have experience using the upload webp converter on larger files? Or come across similar issue? Thanks.

By daniel - September 7, 2022

Hi Codee,

There are a number of reasons the conversion could fail when using such large image sizes, though I have confirmed that it's possible to convert a 25MB PNG to webp - it just required updating some server settings. A few potential causes are:

  • Reaching memory limit - image operations can take a high amount of memory. This is governed by the "memory_limit" PHP setting.
  • Script timeout - the conversion can take longer for large files (on my test server, the 25MB PNG converted in ~8 seconds). This is governed by the "max_execution_time" PHP setting, as well as the server's speed.

In addition to looking into the above settings, you can also see if it's possible to enable the Imagick PHP extension on the server. Generally, Imagick is faster and more memory-efficient when doing image operations than the built-in PHP functions, so this may also help with some of these limitations.

Let me know if you have any other questions!


Technical Lead

By Codee - September 14, 2022

Hi Daniel,

The web host documentation states the following with regards to Imagick and Image Magick:

"Accessing ImageMagick

By default, ImageMagick is installed on InMotion Hosting servers. However, it can only be accessed through the command line, a cron job or PHP code on a web page. The path for the command line options would look like this:

  • /usr/bin/convert
  • /usr/bin/mogrify

ImageMagick has many modules that can be loaded, but for the purposes of InMotion’s hosting servers, the main commands available are convert and mogrify. These commands can be used through PHP using a native extension called Imagick. For more information, please see the Imagick class in the PHP documentation.


If I click on the link to the Imagick class it basically lists out a very long section of php documentation.  So my question is: Since this documentation states that Imagick has to "be accessed through the comman line, a cron job or PHP code on a web page" -- is there something 'else' that needs to occur for it to automatically run/work with the CMSB webp conversions? Or is it already taken care of?


By Codee - September 15, 2022

Hi Daniel,

Imagick IS crossed out. GD is not crossed out.

By daniel - September 19, 2022

Hi Codee,

In that case, the PHP module for Imagick does not appear to be enabled. This is something that would need to be done on the server by the host, though not all hosts will support it. 

Have you looked into the memory_limit and max_execution_time settings? You can find the current values for both of these settings on the General Settings page in CMSB, under Admin Menu.


Technical Lead

By Codee - September 19, 2022

Hi Daniel,

I have access to WHM-root so I can enable/disable the imagik extension. I did so earlier but ran into the same issues...when I reviewed the error it was definitely related to exceeding the memory limit on the test uploads.  I disabled it and then your reply came in :-)

Here are the details from the CMSB settings section. Could you tell me what numbers, specifically, would work better (provided I can change them)?

max_input_time: 120

max_execution_time: 300

post_max_size: 102M

upload_tmp_dir: ulimit

max cpu seconds: unlimited

upload_max_filesize: 102M

memory_limit: 128M

ulimit memory limit: unlimited

Thank you kindly!

By daniel - September 19, 2022 - edited: September 19, 2022

Hi Codee,

When testing locally using gd and a 30MB PNG, it works with a memory_limit of 512MB, so I'd suggest trying that out. You can change it in /cmsb/lib/init.php - there should be a line like this:

ini_set('memory_limit', '128M');

You can change this to whatever value you need. Note that this value will be overwritten during CMS upgrades, so you should make a note of the change.

Your max_execution_time is 6 minutes which generally should be fine, though if the process hangs for exactly 6 minutes that could be a clue.

Let me know if this helps!


Technical Lead

By Codee - September 20, 2022

Hi Daniel,

That helped quite a bit.  Thank you.