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, where you can view, edit and manage your media files.
You can also integrate various plugins with your library to kick it up a notch. It’s flexible, portable and customizable. 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 this will 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 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 82% of their original compression level. In case you’re wondering, the photo above 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 Smush); your double-compressed photos can start looking pretty messy.
Fortunately, there is a way around the enforced compression. Just follow Raelene Wilson’s simple guide, or download the super simple Disable JPEG Compression plugin.
How to Prevent Duplicate Image Files
Whenever you upload an image file to WordPress, it is likely to be duplicated into multiple sizes. This can be 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 more 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 Media Cleaner 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.
In the Media Library, select the image you want to edit …
Next, click the Edit Image button …
And you’ll be presented with a screen that looks 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 tips to help you along the way. Whenever you’re at a loss, just hit one of the blue question marks for more information:
Click on ‘?’ for helpful information on image editing functions.
Tip: If you have Smush installed on your site (even the free version of our Smush Pro image optimizer plugin has this feature), you can set dimensions to auto-crop all uploaded images. This feature is especially useful for photographers who may upload massive images, as they will save themselves a ton of server space.
Scaling an Image
Scaling images is very important. In fact, one of the most common recommendations from Google PageSpeed insights is to “properly size images.”
According to Google …
Ideally, your page should never serve images that are larger than the version that’s rendered on the user’s screen. Anything larger … just results in wasted bytes and slows down page load time.
(Source: developers.google.com)
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 accidentally scale your image down to a miniscule size, there’s no need to re-upload the image – just press the Undo button and have another go.
Also, if you are scaling multiple images, adjusting the size of all images one-by-one can be extremely time-consuming. You can automate this tedious task using an image optimization plugin like Smush Pro.
Smush Pro can perfectly scale all your images in just one click. Simply turn on Smush’s CDN and it will perfectly size AND serve all your images in a next-gen format (WebP), resolving two common PageSpeed Insight recommendations with one click. For more information, check out our guide on how to properly resize and serve scaled images with WordPress.
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 Export 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.