Get Vimeo Video Thumbnail From Video Url

When we need to display a Vimeo video thumbnail on the page as a placeholder we can call it from Vimeo API.

Please insert the below function in function.php to fetch the thumbnail image.

function grab_vimeo_thumbnail($vimeo_url){
    if( !$vimeo_url ) return false;

    $data = json_decode( file_get_contents( 'http://vimeo.com/api/oembed.json?url=' . $vimeo_url ) );

    if( !$data ) return false;

    return $data->thumbnail_url;  OR
    return $data->thumbnail_url_with_play_button;  
}

Now we can call the “grab_vimeo_thumbnail()” function anywhere with the Vimeo video URL.

Please find the demo below.

I have called the demo video thumbnail with function API.

Submit a Comment

Your email address will not be published. Required fields are marked *

Subscribe

Select Categories