You appear to be a bot. Output may be restricted
Description
Force the thumbnail size to be what we asked forwp_attachment_get_image_src() can sometimes attempt to return a $thumbnail where the width and height don't match what we asked for. The values of $thumbnail[1] and $thumbnail[2] are used to set the width and height values on the <img> tag We choose to reset these to the values first thought of. Note: The side effect of this is that the images get reshaped rather than being cropped. It's up to the web designer to set the sizes for thumbnail, small, medium and large and/or upload images that will scale nicely for the chosen figures.
- /05/08 When either the required width or height is set to 0 then the size of the image is set by scaling, maintaining the aspect ratio In the shortcode this can be specified using thumb=0xnn to set the height or thumb=nnx0 to set the width. Set the height when you want the images laid out in a row, and the width when you want them in a column. When the $size is NOT an array then we do not attempt to force the size, allowing the images to display responsively.
- $thumbnail
- ( mixed ) required –
- $size
- ( mixed ) required –
Usage
bw_force_size( $thumbnail, $size );
Parameters
Returns
voidSource
File name: oik/includes/bw_images.incLines:
1 to 12 of 12
function bw_force_size( $thumbnail, $size ) { if ( is_array( $size ) ) { $aw = $thumbnail[1]; $ah = $thumbnail[2]; $thumbnail[1] = _bw_new_width( $aw, $ah, $size[0], $size[1] ); $thumbnail[2] = _bw_new_height( $aw, $ah, $size[0], $size[1] ); } else { //$thumbnail[1] = null; //$thumbnail[2] = null; } return( $thumbnail ); }View on GitHub View on Trac