generateblocks icon indicating copy to clipboard operation
generateblocks copied to clipboard

Image Block - include medium large attachment size

Open diggeddy opened this issue 2 years ago • 1 comments

Description

GB Image block has same behaviour as core block and omits the medium_large attachment size. It seems WP like to leave it out. But it can be added using this filter:

add_filter( 'image_size_names_choose', function() {
	return [
		'thumbnail'    => __( 'Thumbnail', 'textdomain' ),
		'medium'       => __( 'Medium', 'textdomain' ),
		'medium_large' => __( 'Medium Large', 'textdomain' ),
		'large'        => __( 'Large', 'textdomain' ),
		'full'         => __( 'Full Size', 'textdomain' ),
	];
} );

Is it possible to make the GB image block list other sizes without using the filter ? Even if only the Medium Large is listed

diggeddy avatar Apr 22 '22 14:04 diggeddy

@diggeddy currently, this is a limitation from core itself as they hard-coded the sizes. I'm pushing this for next version so we can implement our own solution.

https://github.com/WordPress/gutenberg/blob/trunk/packages/block-editor/src/store/defaults.js#L132-L137

JeanPaiva avatar Apr 26 '22 11:04 JeanPaiva