In rare cases, you might see a WordPress error message like this during the image upload process:
'Post-processing of the image has probably failed because the server is busy or does not have sufficient resources. Uploading a smaller image might help. The maximum recommended size is 2560 pixels.'
This error does not depend on our Image Optimizer plugin, but on your server settings and features, which may not be sufficient to support it.
Before contacting our support, we encourage you to perform some checks that may help you solve the problem on your own.
Ensure the HTTP Error is Not Temporary
Start by checking the file name for special characters, such as apostrophes. If any are present, rename the image file to remove them.
Next, wait a few minutes and try uploading the image file again. The error might simply be due to temporary server issues, such as high traffic or limited resources, which are often resolved automatically on most WordPress hosting servers.
If the issue persists, try uploading a different file to see if the problem is specific to the original image. Additionally, clearing your browser cache or switching to a different browser can sometimes resolve upload errors.
Should the ‘Post-Processing of Image Failed’ error continue to appear after these steps, the issue is likely not a temporary glitch. In that case, proceed with further troubleshooting.
Increase WordPress Memory Limit
The error may indicate that the server does not have enough resources. To solve it, you can increase the available memory for WordPress.
To do this, edit the file wp-config.php and add the following code:
define( 'WP_MEMORY_LIMIT', '512M' );
This command sets the WordPress memory limit to 512 MB, a value that is generally adequate to solve any problems related to insufficient memory.
Also, verify that the file you are trying to upload does not exceed the maximum size limit allowed by your Web site.
Adjust Upload Timeout Settings
If you’re on shared hosting, increase the timeout settings to allow the server more time to process large files:
php_value max_execution_time 180
php_value max_input_time 180
Modifying the Image Editor Library
WordPress uses two PHP modules for image post-processing: ImageMagick and GD Library. Depending on availability, it may automatically select one of the two.
However, ImageMagick can sometimes encounter memory problems, causing errors when loading images. To solve this, you can configure WordPress to use GD Library as the default image editor.
To do this, add the following code to your theme’s functions.php file, in a site-specific plugin, or using a code snippet plugin:
function cb_image_editor_default_to_gd( $editors ) {
$gd_editor = 'WP_Image_Editor_GD';
$editors = array_diff( $editors, array( $gd_editor ) );
array_unshift( $editors, $gd_editor );
return $editors;
}
add_filter( 'wp_image_editors', 'cb_image_editor_default_to_gd' );
This change sets GD Library as the default editor, reducing the risk of ImageMagick-related errors.
More solutions
Since this error can have several causes, not directly concerning our plugin, we list some possible solutions that, based on our research, have helped other users:
- Clear the browser cache.
- Try using a different browser.
- Update the version of PHP to the latest available.
- Disable and re-enable the VPN (if in use).
- Check the CDN rules (if in use).