How To Limit Media Upload Size In WordPress
I have a client who runs several magazines with accompanying online blogs. They put out ALOT of content and ALOT of pictures. The client understands the important concept of downsizing photos for web to help with load time, SEO, site performance, etc. and she has worked very hard to convey these concepts to her employees but some things just don’t stick.
Fast forward and the blogs are quickly approaching 70GB in disk space, primarily due to the 1-2MB photos that are uploaded on a somewhat regular basis. We rely heavily on image thumbnails to crank down the photo sizes but that can only do so much. Looking for more solutions, I turned to the PHP server configuration to downsize and limit the maximum file upload size and it was very easy to implement. To complete this task, I simply jumped into the .htaccess file and added the following line to the very top of the file:
php_value upload_max_filesize 1M
Just like that, now on our main media upload screen with have a maximum upload file size defined of 1MB:
Just as a quick update, we went back in and modified this particular site down to 500KB to ensure files stayed even smaller. As you would probably expect, the .htaccess line item to achieve this would be:
php_value upload_max_filesize 500K
I will also be implementing WPMU Dev’s Smush Pro Plugin over the next day or two. I will be back with a review and update as we try to smush five years worth of 2MB images.
**Update – the WPMU Dev Smush Pro Plugin has now been added to the WP Cover plugin write-ups. View more info on it: WP Smush Pro By WPMU Dev