All Collections
FAQ's and Troubleshooting
Gallery Images Are Being Cropped
Gallery Images Are Being Cropped

Gallery Images Are Being Cropped

Marius avatar
Written by Marius
Updated over a week ago

For each uploaded image, WordPress creates a unique size on image upload to be used in various places.


Those are called thumbnails. One of the thumbnails is the one from the Gallery module, which is set to default by the theme to a value of 400x516px when set to portrait and 400x284px when set to landscape. That means in some situations, the images when you are setting the module as Grid, are cropped.


To change the thumbnail size you will need to add this code to the functions.php of the child theme, make sure to use one, you can learn about how to create one here:
โ€‹

add_filter( 'et_pb_gallery_image_width', 'custom_image_width' );
function custom_image_width($width) {
return '600';
}

add_filter( 'et_pb_gallery_image_height', 'custom_image_height' );
function custom_image_height($height) {
return '400';
}

add_image_size( 'custom-image-size', 600, 400, array( 'center', 'center' ) );

If you want the images to be displayed with their original size, replace the values with 9999.

After you changed size you will need to regenerate thumbnails, here is the plugin for this: https://wordpress.org/plugins/regenerate-thumbnails/

Did this answer your question?