I've got a page where the featured image shows up in a very different format than anywhere else. Now I did add a function to edit the post image attributes, in order to control output size - but that works everywhere except that one page.
// Change default featured image size.
add_filter( 'beans_edit_post_image_args', 'mk_post_image_edit_args' );
function mk_post_image_edit_args( $args ) {
return array_merge( $args, array(
'resize' => array( 1200, 400, true ),
) );
}
add_filter( 'beans_edit_post_image_small_args', 'mk_post_image_small_args' );
function mk_post_image_small_args( $args ) {
return array_merge( $args, array(
'resize' => array( 800, 300, true ),
) );
}
There isn't any other function which relates to or hooks up with the post image anywhere. Yet for some reason on that one page the image gets a max-width of 427px and is output with the dimensions of 427 by 270px.
Apparently it gets a markup-id of beans_post_image_small_item. While on desktop.
<source media="(max-width: 427px)" srcset="https://www.medischekeuringen.net/wp-content/uploads/beans/images/pmo-8ac34b8.jpg" data-markup-id="beans_post_image_small_item">
I'm stumped. Any ideas?
Hey J.C.
What is the size of the original image uploaded? Could you please post a link to the page if it isn't on a local install?
Thanks,
https://www.medischekeuringen.net/pmo-preventief-medisch-onderzoek/
The source image itself is 2560 x 1440: https://www.medischekeuringen.net/wp-content/uploads/pmo.jpg
Hey J.C.,
I checked the original image and the size is 427x240
. Your code work fine but the original size for that specific picture is smaller than the resize so it doesn't work.
Cheers,
Well that is insanely weird. When I call up the raw image url, I get the 2560 size. Think I'm going to have a word with my browser cache - again.
Hehe, yep it can be your browser cache or even server cache 😉