...

How to restrict uploaded image size in WordPress

how-to-restrict-uploaded-image-size-in-wordpress

Want to know one of the worst things about administering a WordPress-based website?

The media library.

Specifically: allocating enough hosting space, backing it up, restoring it, and moving it between hosts if the site is being moved.

The more images your authors add to the library, the the bigger it gets. And WordPress doesn’t exactly help. Firstly it has auto image resizing facilities, and secondly the file size limit for each uploaded image is at least 2Mb and may be as high as 10Mb or more depending on the server the site is running on.

These facts mean that WordPress authors have absolutely no incentive to resize images before uploading, meaning that a frequently-updated WordPress site probably has hundreds of photo files, uploaded directly from a camera or phone, taking up many megabytes or even gigabytes of space, when they are never displayed at full size on the website.

Wouldn’t it be better to persuade website authors to shrink photos to a reasonable size before uploading? I think it would. 1Mb is plenty big enough for a 1024×768 JPG which will probably still only be shown at reduced sizes. You could even try 0.5Mb and see how many complaints you get from authors.

Happily, there is a plugin that will allow you to set a maximum image upload file size, without affecting other uploads (movies, PDFs, etc). It’s called WP Image Size Limit (click for the repository link).

If you have a WordPress site with many authors and an unmanageably huge media library, install this. It won’t shrink your existing library, but it will stop it getting bigger so quickly.

Incidentally, if you prefer to take the approach of restricting image dimensions rather than file size, there’s a plugin for that too: Imsanity (love the name). I have tried this one myself and it works very well. Imsanity will not only reduce new uploads to specified dimensions, but it will go through your existing library and shrink large images as well, if you ask it to.

Discover more from WIREDGORILLA

Subscribe now to keep reading and get access to the full archive.

Continue reading