When uploading a large amount of images, you might run into an issue, where some of the images fail to upload and you end up with an incomplete collection.
We know that this can be incredibly frustrating, but fortunately there are two things you can try to resolve this issue:
1. Increase Memory Limit
You might run out of memory when you upload a large amout of images at once, so you want to give WordPress as much memory as possible. How much you have available depends on your hosting provider and plan.
A first step is to go to “Tools > Site Health” in your WordPress Admin and click on “Info”. Under “Server” look for “PHP memory limit” and copy the value next to it.
Look for the following code in your wp-config.php
file and replace the value with whatever you copied from the PHP memory limit. In this example, we would add the following to wp-config.php:
define( 'WP_MEMORY_LIMIT', '1024M' );
Code language: JavaScript (javascript)
2. Switch to GD as the default image processor
Depending on your server setup WordPress – or rather – PHP might have more than one image processing library available. One of them is called ImageMagick, and while there are pros and cons to both of them, it can run out of memory and could be the cause of your uploading issue.
With the following code you can set the other image processor, called GD (“Graphics Draw”), as the default:
function my_picu_default_to_gd( $editors ) {
$gd = 'WP_Image_Editor_GD';
$editors = array_diff( $editors, [ $gd ] );
array_unshift( $editors, $gd );
return $editors;
}
add_filter( 'wp_image_editors', 'my_picu_default_to_gd' );
Code language: PHP (php)
On top of our developers page you find some instructions on how/where to use this snippet.
(Note about ImageMagick vs. GD: The former will allow WordPress to create preview images for uploaded PDF files, whereas the latter cannot. Also, GD will not transfer the original IPTC data to the thumbnail images it creates. We recommend, that you run some tests, to make sure everything else is still working as expected, after you make the switch.)
We hope those tips allowed you to resolve your WordPress upload problems.
If you have questions about any of the suggested solutions or are still having issues, do not hesitate to contact us. We are happy to help!