check attachment.sizes[size]

If you wanna use custom image sizes, add this filter:
```php
add_filter( 'image_size_names_choose', function() {
$possible_sizes = get_intermediate_image_sizes();
unset( $possible_sizes['full'] );
return $possible_sizes;
} );
```