Hi, posted this question on Facebook before i saw there was a forum, so it’s probably better to ask my question here !
I would like to control which sizes are shown in the images “sizes” dropdowns for the Bricks elements (image, carousel, …) like this is the case on the Wordpress admin.
I don’t use the default WP sizes, only my custom ones, with the “image_size_names_choose” filter. But Bricks doesn’t take this filter into account.
I was able to solve this by updating two functions :
get_image_sizes_options() in includes/setup.php
get_image_metadata() in includes/ajax.php
Is it possible for you to implement that ?
Can add the code here if interested.
I’m also using custom image sizes. In this case I’m adding two image sizes. I’m seeing all the registered image sizes when adding an Image element. Here’s the code I’m using.
// Add image sizes
add_action( 'after_setup_theme', 'irw_add_image_sizes' );
function irw_add_image_sizes() {
add_image_size( 'irw_medium_plus', 600 );
add_image_size( 'irw_medium_large', 800 );
}
// Register the image size names for use in Add Media
add_action( 'image_size_names_choose', 'irw_custom_size_names' );
function irw_custom_size_names( $sizes ) {
return array_merge( $sizes, array(
'irw_medium_plus' => __( 'Medium Plus' ),
'irw_medium_large' => __( 'Medium Large' ),
)
);
}
The same way, but i remove all the default sizes (except the thumblail).
Then for my custom sizes i use my own resizing/optimizing API.
Currently with Bricks, all the sizes are shown in dropdowns (thumbnail, medium, large + custom sizes).
What i’d like is that Bricks take into account the image_size_names_choose filter, so i can choose which sizes are selectable.