This is very easy. Vimeo has API. This is the Vimeo Simple API docs.
You should make a Video Request
To get data about a specific video, use the following url:
http://vimeo.com/api/v2/video/video_id.output
video_id The ID of the video you want information for.
output Specify the output type. We currently offer JSON, PHP, and XML formats.
So fow example getting this URL http://vimeo.com/api/v2/video/6271487.xml. You will get xml output, with video information.
Parse this for every video to get the thumbnail
Here’s approximate code in PHP:
1 2 3 | $imgid = 6271487; echo $hash [0][ 'thumbnail_medium' ]; |
Also you can do this with javascript.
01 02 03 04 05 06 07 08 09 10 11 12 | function vimeoLoadingThumb(id){ var id_img = "#vimeo-" + id; var script = document.createElement( 'script' ); script.type = 'text/javascript' ; script.src = url; $(id_img).before(script); } function showThumb(data){ var id_img = "#vimeo-" + data[0].id; $(id_img).attr( 'src' ,data[0].thumbnail_medium); } |
Show image:
1 2 3 4 5 6 7 | <img id= "vimeo-{{ video.id_video }}" src= "" alt= "{{ video.title }}" /> <script type= "text/javascript" > vimeoLoadingThumb({{ video.id_video }}); </script> |