Two quick questions.
How does default thumbnail size work?
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails');
set_post_thumbnail_size( 800, 600, true );
}
What does above code really mean?
Does it mean all my thumbnails will be 800×600 or smaller? Because even after setting set_post_thumbnail_size get_post_thumbnail_id($post->ID)
points to full-sized thumbnails (like 2500×1200). I don’t really need that big images…
When do WordPress create (custom) thumbnails?
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails');
set_post_thumbnail_size( 800, 600, true );
add_image_size( 'foo', 400, 300, true );
add_image_size( 'bar', 200, 150, true );
}
When are these custom thumbnails created (like image-800×600.jpg / image-400×300.jpg etc.) ? Only during upload process? What if I’m just changing themes to theme based on add_image_size functions with different thumbnail sizes, do I have to reupload all my images to get right sizes? If yes, then using timthumb over add_image_size wasn’t that bad idea…
Thanks!
To answer your first question, the first chunk of code is specifically for adding more custom thumbnail sizes. Don’t let the word “thumbnail” trick you, in fact I use the function mentioned above to register large images that fit in very specific places in themes such as custom sized banners and things like that.
In order for your thumbnails to “take” to any changes you made to the settings, via your functions.php file, you will need to regenerate them. You can do so by using the Regenerate Thumbnails plugin, although you will most likely lose any custom cropping. That is most likely why your theme is pointing to the full size image. Currently there is no image at the set size for your thumbnail, so it defaults to the original.
To answer your second question, yes, they are created when you upload them, although there are some plugins you can use to customize the crop after the upload process. And no, you won’t have to re upload all of your images, but you will have to regenerate your thumbnails as mentioned above.
I will say in closing that thumbnails can be a pain, which is why I try to make sure that I nail the sizes I need down before I start any project, however having thumbnails that are the same aspect ratio, but different sizes can really help reduce load time, and strain on a server.
Thumbnails are only created during file upload. But there is a plugin that can remake all your thumbnails ( delete the ones that aren’t used anymore and create new ones from the original images ). It’s called Regenerate Thumbnails.
Timthumb is a really bad idea, as it has really nasty security issues. I suggest you to use WPs functions, as they’re much better. Timthumb also uses resources because it generates thumbnails on the go.