[Support request] Media Attachment Size

Home Forums Support [Support request] Media Attachment Size

Home Forums Support Media Attachment Size

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #2025648
    Igor

    WordPress generates different sizes for one image.
    How to make pictures of different sizes displayed on a computer screen – full size(1200px), and on a mobile device – medium large size(768px)?

    #2025977
    David
    Staff
    Customer Support

    Hi there,

    the browser will select the image that is most appropriate for its screen size and resolution.
    However if you want you can ‘nudge’ the browser to use specific sizes using this PHP Snippet:

    function db_modify_srcset_sizes($sizes, $size) {
        $sizes = '(max-width: 768px) 768px, (min-width: 769px) 1024px, 100vw';
    	return $sizes;
    }
    add_filter('wp_calculate_image_sizes', 'db_modify_srcset_sizes', 10 , 2);
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.