I recently installed fresh WordPress on a server with Apache and migrated to my website. But, after migration, i started facing this issue while changing the logo or favicon.
So, I found a solution for this, here’s how to fix the “There has been an error cropping your image” issue in WordPress.
Cause of issue: GD extension in PHP is missing.
What is GD extension in PHP?
GD extension is an extension for all the functions related to images are handled by GD library/extension. It includes image processing, compression, cropping etc. Read more: https://www.php.net/manual/en/book.image.php
Image Formats supported by GD:
For Cloud Hosting users with SSH access:
Login to your server with SSH client(prefer Putty)
Paste the follwing command and hit enter.
sudo apt install php7.4-gd
Replace the 7.4 with your currently installed PHP version.
Check your php version:
I would recommend you to install the required PHP extensions by entering the following command and hit enter.
sudo apt install php7.4-mbstring php7.4-xml php7.4-mysql php7.4-common php7.4-gd php7.4-bcmath php7.4-json php7.4-cli php7.4-curl php7.4-zip
For Shared Hosting user:
Go to your Hosting Control panel
Got to Advanced>PHP Configuration
Go to PHP Extensions section
Find and Enable GD extension
That’s it! Problem Solved