Posted on May 30, 2011 in WordPress | 0 comments
Web Designers have discovered many problems over the years when trying to upload files to their WordPress websites via the media library. Sometimes the version of WordPress is at fault; sometimes it’s a plugin; sometimes it’s the computer being used to make the upload; and frighteningly often, it’s your host’s server settings. This is not to knock the creators of WordPress at all; they do the best they can, but there are many factors involved, and sometimes the host for the website simply doesn’t allow PHP what it needs to function effectively.
Just be aware that there can be many issues when using the media library to upload files, and that these issues may have the same symptoms but different causes.
If you find that you cannot upload any files over a certain size, it’s likely due to a php.ini setting. Your Media Library upload page may state the low limit (in the example above, “Maximum upload file size: 64M”). Sometimes this may state a high limit, but you’ll find that you cannot upload any files over a certain size that’s much lower than the stated limit.
If you can modify your own php settings, try adjusting memory_limit, post_max_size and upload_max_filesize to something larger.
If that doesn’t work, talk to tech support. Some web hosts (notoriously, Startlogic) will force a low limit and not allow you to change it. Then you’re just stuck. If this is the case, you can either upload the images somewhere else–perhaps using a CDN–or you can manually FTP the files to your server.
Note that if you manually upload the files, even into the wp_uploads directory, they will not appear in the Media Library. This is because they are not in the database. Use the Add From Server plugin, once you had uploaded the files, to add them into the database. Then they will appear in the library as normal.
Do you see something like this when uploading files in the “Crunching” stage? (Remember, if you see just “HTTP Error,” set display_errors to on in your php.ini.)
Fatal error: Out of memory (allocated 67371008) (tried to allocate 10516 bytes) in /home/yourusernamehere/public_html/wp-includes/media.php on line 254
If you see this, you might try some experimenting. What you’ll probably find is that the image format doesn’t matter, nor does the file size of the image–but high-resolution images will cause the issue. For example, a JPG image 2000 pixels wide by 3000 pixels high, 2MB in size may cause the problem, but an image 200 pixels wide by 300 pixels high, 10MB in size may not have any issue.
You may also notice that if you go back to the media library after the failed upload, you will see the image there, but its stated size is 0x0 pixels and you cannot insert it into a page at anything other than full (massive) size.
You can find some tips about what to do when you see an out of memory error when uploading images in WordPress, but if your situation is like mine, this is happening because the image is too high resolution and the server is not allowing enough memory for PHP.
If you can crop or shrink the image down before uploading it, that will resolve the issue. However, sometimes having the high-resolution photo is an important part of your content.
You can try talking to tech support, simply telling them that you’re getting out of memory errors in PHP (better yet, showing them the exact error) and asking if the limit can be increased. Unfortunately, the answer is often “no.”
If all else fails, FTP the file manually or host it on another server–or just take advantage of the way the failed upload still uploads the file (but without “crunching” it so you can insert it in different sizes). One way or another, get the full-sized file on the server. Then, on your computer, manually scale your local copy of the image down to something easier for PHP to work with, and upload that through the media library. Then have the link for the image link to the original full-sized image you uploaded. It’s a convoluted solution, but if all else fails that will get the job done.