Setting post thumbnail sizes in template file and functions.php

I don’t think your code is the issue here. But there are a few caveats that you need to be aware of and account for.

First off always keep in mind that when using add_image_size() that WordPress does not regenerate the images size if it was uploaded before you registered the new size. The newly registered size will only apply to future uploads.

  • The new size will not be created by default for images uploaded previously. You can use the ‘Regenerate Thumbnails’ or similar plugin to create and update the registered sizes.
  • Images uploaded after you’ve registered the new size will automatically have the correct image sizes generated.

Unless you are setting the ‘crop’ option on the add_image_size() to TRUE you’re actually scaling the image to fit within the boundaries of the dimensions. So uploading an image that falls outside of either boundary (height or width) will result in scaled down version of your upload. My understanding is that the scaling is proportional, so in your case if you uploaded an image that 428 px w x 73 px high the resulting image would be 214 px w x 36 px high.

This can get pretty hairy when providing custom sizes to an end-user.

error code: 521