Skip to content

Responsive images

The VIP File System serves images with the srcset and sizes attributes to all images.  Example:

<img src="https://site.go-vip.co/wp-content/uploads/2018/09/image.jpg"
    sizes="(max-width: 660px) 100vw, 660px"
    srcset="https://site.go-vip.co/wp-content/uploads/2018/09/image.jpg 5472w, https://site.go-vip.co/wp-content/uploads/2018/09/image.jpg?resize=300,169 300w, https://site.go-vip.co/wp-content/uploads/2018/09/image.jpg?resize=768,432 768w,https://site.go-vip.co/wp-content/uploads/2018/09/image.jpg?resize=1024,576 1024w"
    width="660"
    height="371" />

To implement a custom srcset implementation, disable the responsive image support by using this filter:

add_filter( 'vip_go_srcset_enabled', '__return_false' );

Note

WordPress only outputs images with the same aspect ratio to the srcset attribute. For images of different aspect ratios, consider using the wp_calculate_image_srcset filter.

Last updated: November 22, 2022