Install ImageMagick for PHP 7.4 on Ubuntu 18.04

Long story short, my fiance just got a new Galaxy S21 Ultra. Yes, the one with the 108MP camera. That means we’re getting pictures that are 20-40MB in size in most cases. Of course, that increased picture size causes issues with uploading and image post-processing in WordPress. I was getting the following error even for uploading a single image:

Post-processing of the image failed likely because the server is busy or does not have enough resources. Uploading a smaller image may help. Suggested maximum size is 2500 pixels.

It seemed the fix was to use ImageMagick to handle the post-processing. In my case, I’m running Ubuntu 18.04 with PHP 7.4 FPM. Installing ImageMagick using the regular apt process apparently installs the module for PHP 7.2. Fortunately, after some digging, I’ve managed to get it running:

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt-get install php7.4-imagick
sudo service php7.4-fpm restart

This is day 3 of #100DaysToOffload.

Leave a Reply

Your email address will not be published. Required fields are marked *