4

I am setting the header image in WordPress and when I click on the crop button, it shows me the following error:

There has been an error cropping your image.

enter image description here

4 Answers 4

6

I was facing same issue and unable to understand how to resolve this issue by following given ideas on every portals as I am not hardcore programmer so it was not possible for me to understand their tricks but Now I have successfully troubleshooted this image cropping issue and am sharing my trick how it was troubleshooted.

You just have to open your xampp controller and stop both the services Apache and MySQL and now click on congfig button of Apache and select PHP(PHP.ini), After selecting you will see a config file, find

;extension=gd 

text, Now just remove ; to enable gd services at your system for PHP as by default it comes with commented and save the file and restart both services Apache and MySQL.

I hope this will help you.

1
  • This one works. Just remember to refresh the page before trying to crop again. Commented Jan 5, 2023 at 15:02
4

There is too little information to be completely sure, but usually this error occurs when WordPress cannot find the graphic library which should be installed on your server. So you should check with your provider to see if Imagick and/or GD are installed.

You can also add this little snippet of code in your functions.php file to make sure WordPress looks for both (often it only looks for Imagick):

add_filter ('wp_image_editors', 'wpse303391_change_graphic_editor'); function wpse303391_change_graphic_editor ($array) { return array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' ); } 

This snippet will look for GD first and then for Imagick. The latter gives better quality, but uses more memory, which can also lead to server errors.

4
  • Is there a list of these "extra" requirements anywhere? wordpress.org/about/requirements doesn't mention any PHP libraries that need to be installed. Commented Oct 18, 2018 at 19:04
  • Wordpress assumes there is a complete PHP install on the server. It's not something "extra". Commented Oct 18, 2018 at 20:53
  • You're a life saver thank you, GoDaddy said it was installed but was still throwing the error. This fixed it Commented Mar 9, 2023 at 2:23
  • @cjbj disagree. There are many optional libraries for PHP and gd is definitely optional, as is ImageMagick. It would definitely make sense for these dependencies to be listed somewhere. Commented May 3, 2024 at 18:46
3

I solved this installing the next library

sudo apt-get install php5-gd -> for php5

sudo apt-get install php7.0-gd -> for php7

sudo apt-get install php7.2-gd -> for php7.2

2
  • Didn't even have to refresh the page after install. Thanks Commented Feb 7, 2019 at 18:48
  • On CentOS it's yum install php-gd, for the interested. Commented Mar 22, 2019 at 12:32
0

I had encountered the same issue with my blog, after searching for a while found out that it was because GD library for PHP which was not installed on the server

Since my server is hosted on CentOS, to find the GD Library package within CentOS repository

$ sudo yum list available | grep 'gd' 

Identify GD Library package name and install it

$ sudo yum install php-gd 

Restart apache service

$ sudo service httpd restart 

A detailed article that I wrote can be found here with command output screenshots

1
  • 1
    You appear to be the author of the linked article. When linking to your own site or content (or content that you are affiliated with), you must disclose your affiliation in the answer in order for it not to be considered spam. Having the same text in your username as the URL or mentioning it in your profile is not considered sufficient disclosure under Stack Exchange policy. Commented May 27, 2021 at 0:54

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.