Attachments – Page 3

Image Sizes

In this tutorial we are going to talk about image sizes in WordPress. Well, but what image sizes are exactly?

All right, if you open your WordPress /wp-content/uploads directory, you might find something like this there:

default image sizes in WordPress
All of these – are default WordPress image sizes.

As you can see, an image you’ve uploaded once was duplicated multiple times with different image sizes. And in this case I am just using default WordPress theme with no plugins installed.

Users who don’t know what is the thing – image sizes in WordPress could be terrified by what they see in uploads directory.

The key idea is that when you upload an original image (especially unoptimized, up to 10MB) it would stupid to use this exact file everywhere on the website. Maybe you have a list of recent posts displayed somewhere with 100×100px thumbnails and what about srcset and sizes attributes of course?

A great example is the list of products in WooCommerce in admin area:

Product list in WooCommerce admin
Image sizes here are barely 50×50px, what do you think will happen with page load time if we try to display originals instead?

Needless to say that using image resizing software is also not a great idea because it will create huge performance issues on your server.

That’s why WordPress creates so many image copies and in this tutorial we are going to learn to manage them.

How to Create Image Slider without Plugin (almost)

In this tutorial I am going to show you how you can easily create your own WordPress image carousels or sliders without overloading your website with tons of plugins.

A quick disclaimer though – in case you’re using Block Editor (Gutenberg), then probably a better idea would be to create a block for that purpose or to install Simple Carousel Block created by me.

But in this tutorial we are going to use just custom fields (or options) and an external carousel JavaScript library.

How to Use Image Uploader in WordPress Admin Area

In this tutorial I am going to dive deep in WordPress media uploader functionality. By the way it is possible to implement not for only images but for any supported file types.

This is how it looks in WordPress admin area:

Image uploader field in WordPress option pages
Below in this tutorial I will also describe how to create a settings page like this.

Featured Images in an Admin Column and in Quick Edit

In this tutorial I am going to show you how to do two things at the same time:

  1. Add an admin column for WordPress featured images of any post type.
  2. Add a quick edit option for featured images.

Multiple Image Upload Metabox

I had so many requests about multiple image uploads in comments in this tutorial, so I decided to create a separate tutorial specifically about that.

Our goal is to create something like this:

Multiple image upload metabox
So we can not only select multiple images but even sort or delete them after selection.

Guys, there are actually two ways of creating a meta box like that, the first way is an easy-breezy way, but you have to install my Simple Fields plugin first, the second way – is to do everything manually from scratch. But please do not worry, no matter what method you choose, I am going to cover both of them in this tutorial.

Upload Files to Media Library Programmatically

When you upload files to your website using media uploader in admin area, WordPress usually handles everything for you. So all the uploaded files automatically appear in WordPress media library and after that can be easily managed, inserted to posts etc.

But when you create some custom functionality, or maybe forms on your website front-end, you should handle it by yourself. And in this tutorial I will show you how.

add images to WordPress media library programatically
It is easier to organize your uploaded images using WordPress Media Library. Photos by me.

In this tutorial we are going to take a look on two scenarios:

  1. When upload images from url (not only images of course),
  2. When upload files using a form.

Custom HTML template for images you insert in posts