I've added an image size of 370x150
which works, but if I upload an image to those exact dimensions get_post_thumbnail()
no longer works as expected. If I look into my uploads folder I'll have a thumbnail
, medium
, and full
along with a 1x1
. I add the image size like so:
add_image_size('homepage_featured', array(370, 150));
and call that image like so:
the_post_thumbnail('homepage_featured');
which then pulls up the 1x1 image size. I could probably circumvent this by adding a conditional before my thumbnail call which tests if that size exists:
$thumb = get_the_post_thumbnail($post->ID, 'homepage_featured');
$thumbArr = explode('width="', $thumb);
if(!empty($thumbArr) && is_numeric($thumbArr[1][0]) && $thumbArr[1][0] >= 370)
the_post_thumbnail('homepage_featured');
else
the_post_thumbnail('full');
but that seems silly. Is this a normal thing or is it a problem with my custom theme? Is there a better way to test if a certain thumbnail size exists than the above method?