Fate may have it that basically you could not upload any image in WordPress, and if successfully uploaded it will show images in the media library as broken. In this article, we will show you how to fix image upload issue in WordPress.
The image upload issue in WordPress is one of those irritating errors that has no clear solution, meaning it has a number of different causes and a number of different solutions you’ll need to weed your way through.
This can happen due to a number of reasons. Its possible that your web hosting provider ran an upgrade and something caused the file permissions to change. It is also possible that when one user installs a theme or plugin from an unreliable source, the script ends up mistakenly changing file permissions for everyone.
This issue is most commonly caused by wrong file permissions. Your uploads directory should have correct file permissions otherwise WordPress will not be able to store your files in it or sometimes may not even display files from the upload directory. To set correct file permissions for your uploads directory, you would need a FTP client.
Solutions to Image Issues
There are some tested okay solutions to the issue of image uploading in WordPress which is highlighted below and fully unveil aftermath. They are as follows:
- Rename the image.
- Decrease the image’s resolution.
- Change file permissions.
- Deactivate plugins, especially plugins that optimize images.
- Increase your site’s PHP and WordPress memory limits.
- Remove the file path on the Media Settings page.
- Check to see if the PHP version you’re using is causing issues.
Rename the image
If you’re experiencing this issue with one image, try renaming the file on your computer prior to uploading it to WordPress to start out with. Also mind characters and the file extension used while naming the image.
Make sure there are no apostrophes in your file names as this tends to cause this error to appear.
Make sure your file names are written in all lowercase letters. Try changing the file type if it still doesn’t work, such as turning a .jpg file into a .png file and vice versa.
Optimize the Image
Uploading images that are larger than you need them to be causes a variety of different issues, among them being this image upload issue. It can also cause you to hit your site’s memory limit quicker than it should have.
Try to keep your images at a reasonable width prior to your website's design. You can also pick a maximum file size to optimize your images even more. Most sites stick to a 100 KB maximum file-size rule and optimize their images based on that number prior to uploading them to WordPress.
If you want a quick way of seeing if this is the issue, resize the image in Photoshop or GIMP, and re-upload it to your site.
Change File Permissions to Fix
You’ll need to use an FTP client or access your host’s control panel for this solution. When your host makes updates on your server, they may affect your site’s file permissions, causing the image upload error to appear.
Connect to your website using the FTP client and then go to /wp-content/ directory. There you will see /uploads/ folder. Right click on the uploads directory and select file permissions.
Right-click the Uploads folder, and select File Permissions. Make note of the numeric value that’s already there.
In the Change File Attributes window, change these settings:
Numeric Value: 744
Recurse into Subdirectories: Tick.
Select the Apply to Directories Only radio button.
Click OK once you’re done. Repeat the steps and change the 744 to 755 if it didn’t work for you. Right-click the Uploads folder and select File Permissions if it didn’t work. Enter the original numeric value that was there when you started, and continue to the next solution.
If you use some sort of image optimizing plugins for your images, try deactivating it before uploading images to see if that fixes the image upload issue for you.
Try deactivating all of your plugins if not. If your site has grown quite a bit and uses a lot of plugins, you may be reaching its memory limits, which may prevent you from uploading media files.
Increase Site’s PHP Memory Limit
This could actually be the concern also. Connect to your FTP Client and straight to your web directory root. It’s possible your site has grown to the point where you’re reaching its WordPress and PHP memory limits.
Select your wp-admin folder and find a file called php.ini or php5.ini . If you don’t see it, create one by clicking the New File button in the top left-hand corner. Name the file php.ini and click the Create File button on the pop-up.
Change the value to your most convenient and deserving.
upload_max_filesize = 1000M
post_max_size = 2000M
memory_limit = 3000M
file_uploads = On
max_execution_time = 180
Or if that addition to your php.ini file doesn’t do the trick, try editing your .htaccess file and add or edit the following code at the very bottom:
php_value upload_max_filesize 1000M
php_value post_max_size 2000M
php_value memory_limit 3000M
Or via wp-config.php file
Upgrade Your PHP version
Some users have been able to fix the image upload issue by upgrading to the latest version of PHP or downgrading to a previous version of it. You can do this in cPanel by selecting PHP Config under the Programming, Software/Services or Advanced sections.
If you’re a novice WordPress user, enlist the help of your host to make sure it’s okay for you to change your PHP version as the change could potentially break your site. Backup your site at the very least, especially your .htaccess file.
All you need to do is select a different PHP version in PHP Config, and save your changes.