0
votes

What is an efficient method of working with images in WordPress
such that it uses the least resources and allows for fast loading?

Is it efficient to disable copies of images in dashboard > settings > media?
In other words, is it good to set a value of zero for Thumbnail, Medium, and Large, and just keep the Original sized image? Therefore there would not be 4 copies of the same image, and this would be good because it uses less resources from Wordpress, right?

Below is my gameplan, but I'm not sure if it is efficient:

For my homepage, I will display 200x200 Featured Images (aka Post Thumbnails)
For single.php, I will display a 400x400 version of the same image

  1. Crop images to 200x200 before uploading to WordPress
  2. Use this code

loop.php

<?php the_post_thumbnail( 'full' ); ?>

functions.php

add_theme_support( 'post-thumbnails' );

.
.
Also, when using a plugin to Regenerate Thumbnails, are old images overwritten and deleted? Or do the images keep accumulating? .
.
.

2

2 Answers

1
votes

I think the best way to go here is to set the small and medium sizes to your two desired sizes. The full sized thumbnail size is set to your content width. You can call them then as follow

the_post_thumbnail( 'medium' );

You can upload your image normal size, Wordpress will automatically crop it to the specified sizes. Even if you crop your image before uploading, and upload it then, Wordpress will still create all 4 sizes, full, original, medium and small.

If you need to delete images which doesn't have a supported image size anymore, you'll need a plugin like Force Regenerating Thumbnails. For instance, if you change the medium size thumbnails' size and regenerate it, the original medium sized image won't be assigned anymore to a specific thumbnail size anymore. This plugin will then delete the old medium sized thumbnail.

Just to add, there is no performance difference, and if there are any, it is really minute and insignificant, on the amount of images.

0
votes

add_image_size( 'header-bg', width, height); //function.php
the_post_thumbnail( 'header-bg' ); //where you want to get the