Fix Divi Blurry Gallery Images

Fix blurry Divi gallery images
So we were working with Divi Theme for a client of ours and they wanted a quick gallery. So we put up a Divi gallery for them, but the images looked terrible! So pixalated. Looked aweful. After trying everything we could think of, we FINALLY found a solution! We needed to tell Divi what size images to use. Ha!
note: This will only work for the grid layout

Here is how we did it.

  1. If you dont already have a child theme, you’ll need to create it. You will need to add a piece of code to your functions.php
    tip: if you add it to your Divi functions.php (instead of your child theme) you will need to re-add it every time you update the theme. You do not want to do that!
  2. Edit your functions.php file and add the following code to it:
    [php]
    function my_et_pb_gallery_image_size( $size ) {
    return 350;
    }
    add_filter( ‘et_pb_gallery_image_width’, ‘my_et_pb_gallery_image_size’ );function my_et_pb_gallery_image_size_height( $size ) {
    return 250;
    }
    add_filter( ‘et_pb_gallery_image_height’, ‘my_et_pb_gallery_image_size_height’ );function my_et_theme_image_sizes( $sizes ) {
    $sizes[‘350×350’] = ‘my-et-pb-post-main-image’;
    return $sizes;
    }
    add_filter( ‘et_theme_image_sizes’, ‘my_et_theme_image_sizes’ );
    [/php]
  3. Save and upload it. If you’re using the Theme File Editor, then dont forget to “Update File”
  4. Clear Cache if you have a caching plugin enabled.
  5. That should do it!
    tip: If you still dont see the thumbnails changed, then download the following plugin: Regenerate Thumbnails and run it. Super easy. You can regenerate all your thumbnails at once.