Show Full Image Gallery Thumbnails (Ideal for Square Images)

by Jan 23, 2017Gallery Hacks1 comment

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 😀

1 Comment

  1. E

    This did it for me!
    Thank you.

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.