0

I have 28 pictures uploaded to media library, each around 3mb. Wordpress has already created resized copies of those: thumbnails, medium and large. The pictures are used as Divi's Blurb module images on a given page. They are all being loaded full sized (even if I choose Large when picking an image for module). 28*3mb is a lot.

What I want, is to write a neaty function in functions.php (child theme), that will rewrite all requests for image urls ( e.g. IMG_4321.jpg ), only for this specific page, and only for blurb modules, to urls to those large sized images created by wp ( IMG_4321-683x1024.jpg ). Maybe there's a funciton used by themes for accessing images that I can hook into?

I imagine it would start as:

if( is_page('menu') ) {

}  

But that's as far as I can go.

  • if the image weight is your problem (~3MB for one), you should use optimized/compressed images. either you can use plugin for that or you can manually compress images and upload – Vishwa Apr 26 at 6:07
0

Elegant Themes (Divi) recommend a maximum width of 550px for blurb images (https://www.elegantthemes.com/blog/divi-resources/the-ultimate-guide-to-using-images-within-divi). So you should be resizing your images according to those guidelines for the images that you know will be used in your blurbs. This will ensure that your images don't cause WordPress too much memory effort to resize them on the fly, and should also mean your images will have a smaller filesize too.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.