Responsive Images - Status?

I have been trying to understand how to implement responsive images in X-Theme, and after reading many posts in the forum, it seems like the present answer is “you can’t”? The most complete and accurate information seems to be This Post which in turn referenced This Article, which results in a File Not Found error.

I am trying to implement a simple SRCSET like image swapping scheme to save bandwidth within standard pages. This is not about full-width images or hero images. We have been using the image element in our prototype page but it is not too late to switch.

My question is, have I overlooked a way to accomplish this, or is just a design choice that was made by Themeco to not allow image responsiveness without code hacks?

Thanks!

Hi @ErgoArchitecture,

Thanks for reaching out.

You can check this thread too https://theme.co/apex/forums/topic/responsive-images-srcset-sizes-not-working/

But yes, you shouldn’t do that as its responsive behavior may change which may affect the rendering of the image’s fluid responsiveness. And it’s intentionally turned off for X theme to prevent it. And if you insist, you can edit this file from the theme

\framework\functions\setup.php

and remove this line

add_filter( 'wp_calculate_image_srcset', '__return_false' );

or add this code to child theme’s functions.php

add_action('init', 'enable_x_srcset', 99999999);
function enable_x_srcset () {
remove_filter(  'wp_calculate_image_srcset', '__return_false' ); 
}

Thanks!

Thanks for the quick response!

Unfortunately the link above also leads to a file not found error for me, but I am thinking that I will shine it anyhow.

So is the workaround to simply use the highest resolution you will need and just deal with the slow load times on mobile? Or is X-Theme doing some sort of image-size management in the background?

Sorry about that, please read my responses in this thread for more information: https://theme.co/apex/forum/t/enable-native-wordpress-responsive-images-forth-time-lucky/50592/2?u=christian_y

The solution we provided here is to restore WordPress’ Responsive Image feature. Please read the thread above for more information.

To show that it works when followed correctly, please watch the video below.

Hope that helps.

Hi Christian, and thanks for the reply. It looks like although that would work it may may send us out to the lonely, fragile, unsupported bleeding edge. Since I am a newbie, I think we will just have to go big and eat the bandwidth for now. I think it would be a great feature in the future if you would implement some sort of SRCSET-like image switching from within the image element in the future.

Hi,

We certainly appreciate the feedback! This is something we can add to our list of feature requests. This way it can be taken into consideration for future development. All of these items are discussed with our team internally and prioritized based on the amount of interest a particular feature might receive. Thanks!

Great! And thanks for the excellent support!

You’re welcome! :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.