How do I use Large Images in WordPress?

How do I use Large Images in WordPress?

John Hewick

It’s not uncommon to see an error message when trying to upload large images on WordPress. If you’ve ever seen the message ‘filename.jpg exceeds the maximum upload size for this site’ you’ll be familiar with this issue.

This could be due to one of two reasons. Firstly, your hosting provider could have placed limitations on the size of the file upload. Alternatively, it could be an issue with memory limit. The default setting of your WordPress site only permits a certain amount of memory. If the ‘script’ surpasses this memory, you will encounter a time-out error message.

Whatever the reason, we’re here to help. For those struggling to use large images in WordPress, we’ve put together this handy guide. Depending on your set up, one of these three, quick and easy fixes should work for you.

Fix 1

Add the below code to your theme’s functions.php file:

  1. @ini_set( ‘upload_max_size’ , ’64M’ );
  2. @ini_set( ‘post_max_size’, ’64M’);
  3. @ini_set( ‘max_execution_time’, ‘300’ );

Not only should this increase maximum upload limit, it should also increase the execution time limits as well as post maximum size.

Fix 2

If this doesn’t combat the issue, fear not. Try adding the following code to your .htaccess file which can be found in your website’s root folder.

  1. php_value upload_max_filesize 64M
  2. php_value post_max_size 64M
  3. php_value max_execution_time 300
  4. php_value max_input_time 300

Fix 3

If you’re still having no luck, it’s time to change the values manually using a php.ini file – a configuration tool utilised by PHP to outline settings. Although, users on shared hosting don’t have access to this, you can actually create an empty php.ini in the site’s root folder. Simply create a new file using an FTP client. Now you can add this code which should fix the problem:

  1. upload_max_filesize = 64M
  2. post_max_size = 64M
  3. max_execution_time = 300

A word of warning

It may seem like the sensible choice – using only the highest quality images for that added wow factor – but large image files take much longer to load. It’s something that must be considered before including in any website.

Consumers are now expecting much more from online services and that includes a fast, site speed. In fact, new studies are showing the alarming percentage of users who abandon a website if it takes more than 4 seconds to load. Aside from affecting user-experience, it can also impact your rankings. Search engines will penalise those sites which it considers to offer a less than user-friendly experience. Slow load times is one of the leading factors.

Clearly some websites need high quality images to market their product or brand effectively. In this case, images can easily be optimised for the web on platforms such as Adobe Photoshop. This can compress the image size without affecting quality too much. Alternatively, you can reduce image size in bulk from your WordPress admin area, which can save time for those frequent uploads.

For those that have to use large images, hopefully this guide provided the solution. If it hasn’t, let us know in the comments section and we’ll try and help out.

John Hewick

Author John Hewick

More posts by John Hewick