I have the following code in my theme:
<?php
$size = 'large';
$postimage = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), $size );
$url = $postimage[0];
$h = $postimage[2]
?>
<div style="background-image: url(<?php echo $url; ?>); height: <?php echo $h; ?>;"></div>
Here’s an example var_dump
output for $postimage:
array(3) {
[0]=> string(99) "{base url here}/uploads/2013/10/h3greendeck.jpg?fit=660%2C660"
[1]=> bool(false)
[2]=> bool(false)
}
If I remove the size
argument for wp_get_attachment_image_src()
to let it use default I get the same result. Why is size returning boolean, when WordPress knows the size of the image? This happens for every single instance of this code, regardless of the post I’m viewing.
This sounds like a description of the JetPack’s Photon service.
The Photon API includes the
fit
GET parameter:where
%2C
is url encoded comma.It uses the
image_downsize
filter to overwrite the image retrevial with:where the
width
andheight
are set tofalse
.