The WordPress media library can do a lot more than just store your media files. It is a powerful tool that covers all of your media management needs and more, and I’m going to tell you everything you need to know about it.
In this article, I’ll explain how you can leverage your library to its full potential – discussing everything from image uploading to image compression and uploading limits to the effects of cropping.
I’ll also cover media management in WordPress and image editing using the library. Finally, I’ll present you with techniques on how you can organize and download your entire library without having to use an FTP client.
Let’s get cracking!
An Introduction to the Media Library
The WordPress Media Library is essentially a directory of every single media file that has been uploaded to your site (whether it is ultimately published or not).
Media files include images, videos, audio and even documents. Regardless of where you upload the media to your site, it will show up in the library from where you can view, edit and manage it.
You can also integrate various plugins with your library to kick it up a notch. It’s flexible, portable and customizable. Its advances in recent versions of WordPress have made it one of the most polished features in the world’s most popular content management system.
How to View and Search Your Media Library
You can access the library by clicking Media in the sidebar. You have two viewing options: grid (shown above) and list:
WordPress also enables you to filter and search for images by file type, date uploaded and keyword:
How to Change the Media Library Upload Limit
If you’ve ever attempted to upload large media files, you may have come across an error message along the following lines:
The uploaded file exceeds the upload_max_filesize directive in php.ini
Fortunately, this problem can be solved relatively easily.
But before we proceed, it’s sensible to note that upload limits are there for a reason. Unless you’re uploading a video or audio file (most people will tend to host these on specialized external services), there should be no reason for your media files to exceed your upload limit. Files that take a long time to upload will take a long time to download (which will of course negatively affect the user experience), not to mention the strain put on your server.
Disclaimer aside, Jenni McKinnon wrote a comprehensive piece on increasing the media file upload limit. Check it out if you’re technically minded, but if not, a decent alternative is the free Increase Max Upload Filesize plugin.
How to Enable Image Compression for Uploaded Media Files
Image file size is important for a number of reasons, and fortunately, it is possible to compress images with little to no noticeable difference.
You can read my complete guide to image optimization, but for the purposes of this post, the key step you should take is to install WP Smush. (Oh, and don’t forget to check out the even better premium version, which leaves the competition in the dirt!)
Once installed, this plugin will simply do the job for you – no further work necessary.
How to Disable WordPress’ Default JPEG Compression
By default, WordPress compresses JPEG images to 90% of their original compression level. In case you’re wondering, the photo on the left shows the difference.
You’ll struggle to spot it, which is probably why the core developers saw fit to include this feature.
However, you can encounter problems when integrating additional compression solutions (such as WP Smush); your double-compressed photos can start looking pretty messy.
How to Prevent Duplicate Image Files
Whenever you upload an image file to WordPress, is likely to duplicate it into multiple sizes. This can be highly useful if you, for example, would like to display image thumbnails and link to larger versions. However, for most people, those extra image files represent nothing other than a waste of space.
And if you’re anything like me (read: anal-retentive), all of those redundant files will bug the hell out of you.
Let’s start by checking out the different image size that WordPress wants to create by navigating to Settings > Media:
The solution to this issue is simple and as old as time itself. Well, actually Timothy Bowers handled it back in 2011. Seems like a long time ago, right?
Just change the width and high numbers to 0 and WordPress will stop producing those pesky extra image files.
While you’re at it, if you’ve got a huge archive of redundant images, use the free Image Cleanup plugin to eradicate them in just a few clicks:
How to Edit Images Within WordPress
My general advice would be that you edit your images before you upload them, but if you’re here I’m going to assume that you’re interested in editing image files within WordPress.
Well, you’re in luck, because for a content management system, WordPress offers pretty damn sophisticated image editing functionality. Just click the Edit button within the Media Library and you’ll be presented with a screen something like this:
You’re able to rotate, flip, scale and crop any image in your Media Library, as well as add a caption, alt text, description, and change the filename. You can apply the changes to all sizes of the same image if you’d like by clicking the “All image sizes” radio button under Thumbnail Settings.
The rotate, flip and undo/redo tools are all self-explanatory, so let’s focus on cropping and resizing.
Cropping an Image
Using WordPress you can crop images in multiple ways. The simplest way is exactly how you do it on any other image editing tool: Drag the selection box to choose how you’d like the image to be cropped.
The other way involves one extra step but ensures that the aspect ratio of the image stays intact. Enter the values for your preferred aspect ratio, press the shift key and adjust the selection box.
The third way to crop an image using WordPress’ inbuilt tool is by manually entering the dimensions of the selection box. The dimensions must be entered in pixels. If your pixel estimation game is strong, you can use this last method to crop images.
Does all of the above leave you a little confused? Don’t worry – WordPress has really handy tooltips to help you along the way. Whenever you’re at a loss, just hit one of the blue question marks for more information:
Scaling an Image
Scaling images in WordPress is a lot simpler than cropping and resizing them manually. All you have to do is enter either a new width or height (the other will adjust to keep the ratio correct) and click Scale. Yes, it really is that simple.
The only downside of scaling is that you can only scale down. Scaling up would ruin the pixel density. If you accidently scale your image down to a miniscule size then instead of re-uploading it, press the Undo button and have a go at it again.
How to Download Your WordPress Media Library
Have you ever felt the need to download your entire media library? It may be because you have an excellent collection that you want to have backed up on your system or simply because you need the media files for distribution.
With a bit of googling you’ll find some techniques involving FTP clients. But for WordPress development dummies (don’t worry – I’m one of them) we have an easier way to download the entire Media Library. Just download the free downML – Download Media Library plugin and you’ll be able to download a zip file of your entire library!
Note that, depending upon the size of your Media Library, using this plugin could lead to a timeout. You may need to discuss how to best utilize this plugin with your hosting provider.