Currently the only options for the built-in Divi photo gallery are for “portrait” or “landscape” thumbnails, which means any aspect ratio outside of those will be cut off or cropped. The following snippet allows the thumbnail in the photo gallery to be shown in it’s own natural beautiful glory!
Simply add this to your child’s theme functions.php file:
// Begin remove Divi Gallery Module image crop function pa_gallery_image_width( $size ) { return 9999; } function pa_gallery_image_height( $size ) { return 9999; } add_filter( 'et_pb_gallery_image_width', 'pa_gallery_image_width' ); add_filter( 'et_pb_gallery_image_height', 'pa_gallery_image_height' ); // End remove Divi Gallery Module image crop
I found this snippet on Pee Aye Creative’s site. Click to read their full post titled How To Stop Divi Image Crop – Blog, Portfolio, and Gallery Modules.
Awesome snippet. Many thanks!
Useful immediately.