More fixes

WordPress: "There has been an error cropping your image"

You pick a logo or header image in the Customizer (or a site icon under Settings), drag the crop box, click Crop Image, and WordPress answers "There has been an error cropping your image." The upload itself worked; the server failed when it tried to cut and save the new copy. Usually the server has no image tool switched on, the picture is too big for the memory it has, or the file type is one the server cannot edit. Here is how to tell which in a few minutes.

What the owner sees

harborbakery.example/wp-admin/customize.php

What the checks found


  

Which problem is it? (five minutes)

  1. Try Skip Cropping. The same screen has a Skip Cropping button. If that works, your site is fine and only the editing step fails. If even an image that is already the right size fails, read on.
  2. Check the image tool. Go to Tools, Site Health, Info, Media Handling. "Active editor" should say WP_Image_Editor_Imagick or WP_Image_Editor_GD. If it is empty, or "GD version" and "Imagick version" both say not available, the server has no way to edit images, and that is the whole problem.
  3. Check the size of the picture. A phone photo of 4000 by 3000 pixels or more, or a file over a few MB, can run the server out of memory mid-crop. Shrink it to about 2000 pixels on the long side and try again. If the small copy crops, memory was the cause.
  4. Check the file type. iPhone HEIC files, and WebP or AVIF on older servers, upload but cannot be edited. Save the image as a PNG or JPG (Preview on a Mac, Photos or Paint on Windows) and upload that.
  5. Check for a security block. If small JPGs fail too and the image tool is present, open your browser's developer tools (F12), Network tab, and crop again. A 403 on admin-ajax.php means a security plugin or the host's firewall blocked the crop request.

Fix it, safest first

  1. Upload a picture already the right size and use Skip Cropping. The Customizer tells you the size it wants (for example 250 by 250 for a logo, 512 by 512 for a site icon). Crop it on your computer first. This is the quickest fix and needs no server change.
  2. Switch on an image tool. In cPanel, Select PHP Version, Extensions, tick gd or imagick and save. On other hosts, ask support: "please enable the PHP GD or Imagick extension". Then check Site Health again.
  3. Give WordPress more memory. If only big images fail, ask the host to raise the PHP memory limit to 256M, or add define( 'WP_MEMORY_LIMIT', '256M' ); to wp-config.php above the "stop editing" line, after a backup.
  4. Convert the file to PNG (logos, anything with transparency) or JPG (photos) when it was HEIC, WebP or AVIF.
  5. Check the uploads folder can be written. If the crop fails and Media Library shows a blank thumbnail for the new upload, the server could not save the cropped copy. The upload errors guide covers folder permissions.
  6. Security plugin block: look in the plugin's firewall log for the blocked admin-ajax.php request and allow it, or pause the firewall for the minute it takes to crop, then switch it back on.

What you see, what it means, what it needs

What you seeWhat it meansUsual fix
Every crop fails, Site Health shows no active editorNo GD or Imagick on the serverEnable the PHP gd or imagick extension
Small images crop, phone photos failServer runs out of memory on big imagesShrink the image, or raise the memory limit
Only HEIC, WebP or AVIF files failServer cannot edit that formatSave as PNG or JPG first
403 on admin-ajax.php in the Network tabSecurity plugin or firewall blocked the cropAllow the request, or pause the firewall briefly
Crop fails and the new upload has no thumbnailUploads folder cannot be writtenFix folder permissions (host or File Manager)

What not to do

Most cases are a smaller picture with Skip Cropping, or the host switching on GD. If the host is not helping, that is what the box below is for. Related: upload errors, site icon (favicon), memory exhausted.