By default, the Divi Image Gallery shows you square-cropped versions of the photos in the gallery grid.  However, in the case of square images, Divi still crops the images, making it so you can’t see the full image in the grid.

The code below changes how the image shows up in the grid, enabling you to see the full square image.

 Add this code to your child theme’s functions.php file.

function my_et_pb_gallery_image_size( $size ) {
return 225;
}
add_filter( 'et_pb_gallery_image_width', 'my_et_pb_gallery_image_size' );

function my_et_pb_gallery_image_size_height( $size ) {
return 225;
}
add_filter( 'et_pb_gallery_image_height', 'my_et_pb_gallery_image_size_height' );


function my_et_theme_image_sizes( $sizes ) {
$sizes['225x225'] = 'my-et-pb-post-main-image';
return $sizes;
}
add_filter( 'et_theme_image_sizes', 'my_et_theme_image_sizes' );
Done!

Give this page a share, like, or comment if this worked for you! Leave a comment if you have a question or want to share some love 😀