You appear to be a bot. Output may be restricted
Description
Gets the "thumbnail" image for an attachmentThis no longer sets the width and height of the image. Does this work when we want a really small image?
Usage
$string = bw_get_attachment_thumbnail( $post_id, $size, $atts );
Parameters
- $post_id
- ( int ) required – ID of the attachment
- $size
- ( mixed ) required – size of the required image
- $atts
- ( array ) required – contains the title for the attachment
Returns
string $thumbnail – either an image or just the attachment file nameSource
File name: oik/includes/bw_images.incLines:
1 to 21 of 21
function bw_get_attachment_thumbnail( $post_id, $size, $atts ) { $thumbnail_arr = wp_get_attachment_image_src( $post_id, $size, false ); $thumbnail = bw_array_get( $thumbnail_arr, 0, null); $text = bw_array_get( $atts, "title", NULL ); if ( $thumbnail ) { $thumbnail = bw_verify_file_from_url( $thumbnail ); } if ( $thumbnail ) { $thumbnail_arr = bw_force_size( $thumbnail_arr, $size ); $classes = "bw_thumbnail " . bw_get_post_class( $post_id ); $extras = null; if ( $thumbnail_arr[1] && $thumbnail_arr[2] ) { $extras = kv( "loading", "lazy"); } $thumbnail = retimage( $classes, $thumbnail, $text, $thumbnail_arr[1], $thumbnail_arr[2], $extras ); } else { $thumbnail = wp_get_attachment_link( $post_id, $size, false, false ); } bw_trace2( $thumbnail, 'thumbnail', true, BW_TRACE_VERBOSE ); return $thumbnail; }View on GitHub View on Trac