Helper::get_thumbnail_url( string $size = 'small' )
Returns the thumbnail URL for the current video in loop
Parameters
- $size
-
(Optional)
Default value: 'small'
Return
(array|false|mixed|string|string[]|void)
Source
File: includes/libs/themes/helper.class.php
public static function get_thumbnail_url( $size = 'small' ){
$video = self::current_video_post();
if( !$video ){
return;
}
$result = false;
$sizes = array_merge(
/**
* Filter default sizes to allow additional sizes to be added.
*
* @since 2.0.15
*
* @param array $sizes Registered thumbnail sizes stored as size_name => thumbnail ID in video thumbnails array.
* @param Video_Post $video The current video post being processed in loop.
*/
(array) apply_filters( 'vimeotheque\themes\thumbnail_image_sizes', [], $video ),
[
'small' => 0, // 100x75 px
'medium' => 1, // 200x150 px
'large' => 2, // 295x166 px
'original' => 3, // original image size ratio
'hd_small' => 4, // 640x360 px
'hd_medium' => 5, // 1280x720 px
'hd_big' => 6 // 1920x1080 px
]
);
if( !array_key_exists( $size, $sizes ) ){
$size = 'small';
}
$thumbnails = array_values( $video->thumbnails );
if( isset( $thumbnails[ $sizes[ $size ] ] ) ){
$result = $thumbnails[ $sizes[ $size ] ];
if( is_ssl() ){
$result = str_replace( 'http://' , 'https://', $thumbnails[ $sizes[ $size ] ] );
}
}
if( 'original' === $size ){
$result = remove_query_arg( 'r', $result );
}
return $result;
}
Changelog
| Version | Description |
|---|---|
| 2.0.14 | Introduced. |
