Custom sizes attr
-
Hi,
First I can’t thank you enough for creating this plugin! It’s the first one (and maybe the only one) that actually uses native wp_gallery and implement nicely responsive images with srcset and sizes attr. Great job!
I actually use your filter to customize my sizes attr the following way:
add_filter( 'mgl_sizes', 'mgl_sizes_attr', 25, 4 ); function mgl_sizes_attr( $sizes, $gallery_layout, $attachment, $attr ) { if ( $gallery_layout === 'justified' ) { $sizes = '(min-width: 861px) 500px, 100vw'; } return $sizes; }
The problem I’m facing is that for example with the justified layout I’m using on my website (you can see an example on the linked page), sometimes images take half the width and sometimes images are full width in the gallery. So my question is the following:
Is there a way to customize the sizes attr for every image in the gallery in fonction of their displayed width?
At the moment if an image displays in full width within the gallery on my website, quality is not perfect for this image.
The page I need help with: [log in to see the link]
- The topic ‘Custom sizes attr’ is closed to new replies.