the_post_thumbnail(); only works with fullsize images

You have to tell WP to generate this image sizes at first…

Use function add_image_size and then “regenerate the thumbnails”:

add_image_size( 'custom-size', 220, 180, true ); // 220 pixels wide by 180 pixels tall, hard crop mode

Note “custom-size” string which could be anything you want.
https://developer.wordpress.org/reference/functions/add_image_size/

After that you can use the the_post_thumbnail function with our custom defined image size “custom-size”:

the_post_thumbnail( 'custom-size' );

https://developer.wordpress.org/reference/functions/the_post_thumbnail/

More resources: