Control the srcset, image size for get_the_post_thumbnail

This seems to do what I need. Hero image is full res, blog feat. img for desktop is large and blog mobile featured image loads the medium file and ignores the device pixel ratio on mobile. Blog pages must call
echo get_the_post_thumbnail( get_the_ID() ,'large' );

where page templates w/ hero image using a feat. img must call ‘Full’

function mobile_responsive_images( $attr, $attachment, $size ) {
  if ( $size == 'Full' ) {
    $attr['sizes'] = '100vw';
  } 
  elseif ( $size == 'large' ) {
    $attr['sizes'] = '50vw';
  } 
  
  else{
 // make any customizations based on other image sizes here
    $attr['sizes'] =  '(max-width: 500px) 300px, 50vw';
 // expand to include as many breakpoints as you like. List the larger ones first!
  }
  return $attr;
}
add_filter( 'wp_get_attachment_image_attributes', 'mobile_responsive_images', 10, 3 );

If you see any optimization/proper code to rewrite this please let me know.

deneme bonusudeneme bonusu veren sitelerpulibet girişOnwin Güncel Giriştürkçe altyazılı pornocanlı bahis casino