by axew3 » Wed Jul 06, 2016 9:03 am
Code: Select all
function w3all_ht_custom_image_srcset( $sources, $size_array, $image_src, $image_meta, $attachment_id ){
$w = get_custom_header()->width;
// srcset val
$sources[$w] = array(
'url' => 'myurlimage.jpg',
'descriptor' => 'w',
'value' => $w,
);
return $sources;
}
add_filter( 'wp_calculate_image_srcset', 'w3all_ht_custom_image_srcset', 10, 5 );
the problem is, on chrome, the filter seem to be applied not only to header image, as correctly done by all others browsers, but also, if for example on post gallery, to all others gallery images, that are appearing in this way:
- ScreenHunter_69-Jul.-06-10..jpg (50.61 KiB) Viewed 1113 times
instead than as on others tested browsers, in the correct way:
- ScreenHunter2.jpg (12.02 KiB) Viewed 1113 times
[code]function w3all_ht_custom_image_srcset( $sources, $size_array, $image_src, $image_meta, $attachment_id ){
$w = get_custom_header()->width;
// srcset val
$sources[$w] = array(
'url' => 'myurlimage.jpg',
'descriptor' => 'w',
'value' => $w,
);
return $sources;
}
add_filter( 'wp_calculate_image_srcset', 'w3all_ht_custom_image_srcset', 10, 5 );
[/code]
the problem is, on chrome, the filter seem to be applied not only to header image, as correctly done by all others browsers, but also, if for example on post gallery, to all others gallery images, that are appearing in this way:
[attachment=1]ScreenHunter_69-Jul.-06-10..jpg[/attachment]
instead than as on others tested browsers, in the correct way:
[attachment=0]ScreenHunter2.jpg[/attachment]