Vimeo updated their API to version 3. In the process they have not only deprecated their previous, simple, API. They have also created a giant unwieldy monster that is unusable by 90% of developers in 90% of cases.
Sure, if you want to build an application around the use of vimeo for hosting your videos, this new API may be worthwhile.
But if you are like 99% of people who just want to display a thumbnail of a video hosted on Vimeo, you are **** out of luck. You need to setup library, and run through a bunch of oAuth bullshit. Dashron over on stack overflow seems to be the lead developer for this API and I am sure he had his reasons. I just can’t fathom what they could be.
ANYWAY, angry rant aside I found a workaround for this on Brian Coords website. The following code is his, but I needed to save it here for my future use since there is no way I will ever setup an entire library in a project just to get a thumbnail.
* Grab the url of a publicly embeddable video hosted on vimeo
* @param str $video_url The "embed" url of a video
* @return str The url of the thumbnail, or false if there's an error
* @link https://www.briancoords.com/tech/get-thumbnail-vimeo-api/
if( !$vimeo_url ) return false;
$data = json_decode( file_get_contents( 'http://vimeo.com/api/oembed.json?url=' . $vimeo_url ) );
if( !$data ) return false;
Now to use this function you simple have to pass it the embed URL of your video, like this.
$vimeo_thumbnail = grab_vimeo_thumbnail('https://player.vimeo.com/video/'.$item['vimeo_id']);
<img src="'.$vimeo_thumbnail.'" />
This should return the URL of your thumbnail which you can stick directly into your image src.