The visual presentation of your portfolio items is key to making a strong impression on your audience. However, the default cropping applied to featured images in Divi's Portfolio Module can sometimes detract from the impact by cutting off important parts of your images.
This article will guide you through the steps to remove the default cropping applied to the project's Featured Images in the Portfolio Module, enhancing the visual appeal and effectiveness of your portfolio.
You can normally use any image size for your projects. Divi will automatically crop and resize the images to optimize your page and perfectly align them in the Portfolio module. When using the Grid Layout, the default size to which each Portfolio's Featured image is cropped is 400x284px, giving you an aspect ratio of 100:71.
Remove the default cropping
Install and activate the Code Snippets plugin
Create a new PHP Snippet and place this PHP code:
function custom_portfolio_image_width($width) {
return '9999';
}
function custom_portfolio_image_height($height) {
return '9999';
}
add_filter('et_pb_portfolio_image_width', 'custom_portfolio_image_width' );
add_filter('et_pb_portfolio_image_height','custom_portfolio_image_height' );
add_image_size( 'custom-portfolio-size', 9999, 9999, array( 'center', 'center' ) );Install and activate the Regenerate Thumbnails plugin
Regenerate all of your Thumbnails
Set a custom aspect ratio for Featured Images
The above PHP code will remove the default cropping functionality, which Divi will apply by default to any Featured Image used for projects. However, this will create a new issue if the Featured images are not all the same size, showing all images unevenly.
To address this new issue, check out the How to Change the Featured Image's Aspect Ratio Displays by the Portfolio Module article.