Get img thumbnails from Vimeo?

I want to get a thumbnail image for videos from Vimeo.

When getting images from Youtube I just do like this:

Any idea how to do for Vimeo?

Here is same question, without any answer.

From the Vimeo Simple API docs:

Making a Video Request

To get data about a specific video,
use the following url:

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 getting this URL


Parse this for every video to get the thumbnail

Here’s approximate code in PHP


$imgid = 6271487;

$hash = unserialize(file_get_contents("$imgid.php"));

echo $hash[0]['thumbnail_medium'];  

In javascript (uses jQuery):

function vimeoLoadingThumb(id){    
    var url = "" + id + ".json?callback=showThumb";

    var id_img = "#vimeo-" + id;

    var script = document.createElement( 'script' );
    script.src = url;


function showThumb(data){
    var id_img = "#vimeo-" + data[0].id;

To display it :

<img id="vimeo-{{ video.id_video }}" src="" alt="{{ video.title }}" />
<script type="text/javascript">
  vimeoLoadingThumb({{ video.id_video }});

You should parse Vimeo’s API’s response. There is no way to it with URL calls (like dailymotion or youtube).

Here is my PHP solution:

 * Gets a vimeo thumbnail url
 * @param mixed $id A vimeo id (ie. 1185346)
 * @return thumbnail's url
function getVimeoThumb($id) {
    $data = file_get_contents("$id.json");
    $data = json_decode($data);
    return $data[0]->thumbnail_medium;

Using jQuery jsonp request:

<script type="text/javascript">
        url: '' + video_id + '.json',
        jsonp: 'callback',
        dataType: 'jsonp',
        success: function(data){
            var thumbnail_src = data[0].thumbnail_large;
            $('#thumb_wrapper').append('<img src="' + thumbnail_src + '"/>');

<div id="thumb_wrapper"></div>

With Ruby, you can do the following if you have, say:

url                      = ""
vimeo_video_id           = url.scan(/               # extract the video id
vimeo_video_json_url     = "" % vimeo_video_id   # API call

# Parse the JSON and extract the thumbnail_large url
thumbnail_image_location = JSON.parse(open(vimeo_video_json_url).read).first['thumbnail_large'] rescue nil

Here is an example of how to do the same thing in ASP.NET using C#. Feel free to use a different error catch image 🙂

public string GetVimeoPreviewImage(string vimeoURL)
        string vimeoUrl = System.Web.HttpContext.Current.Server.HtmlEncode(vimeoURL);
        int pos = vimeoUrl.LastIndexOf(".com");
        string videoID = vimeoUrl.Substring(pos + 4, 8);

        XmlDocument doc = new XmlDocument();
        doc.Load("" + videoID + ".xml");
        XmlElement root = doc.DocumentElement;
        string vimeoThumb = root.FirstChild.SelectSingleNode("thumbnail_medium").ChildNodes[0].Value;
        string imageURL = vimeoThumb;
        return imageURL;
        //cat with cheese on it's face fail
        return "";

NOTE: Your API request should like this when requested:

For those still wanting a way to get the thumbnail via URL only, just like Youtube, I built a small application that fetches it with just the Vimeo ID.

Just plug in your video ID and it will pull it and cache it for 28 days so it serves fast.

Here are a couple of examples in HTML:

Simple Image Example

<img src="" />


Modern Responsive Image Example

<img srcset=" 640w, 640w, 200w, 100w" sizes="(max-width: 640px) 100vw, 640px" src="" />

If you want to spin up your own you can do so here.


The easiest JavaScript way that I found to get the thumbnail, without searching for the video id is using:

//Get the video thumbnail via Ajax
    url: '" + encodeURIComponent(url),
    dataType: "json',
    success: function(data) {

Note: If someone need to get the video thumbnail related to the video id he can replace the $id with the video id and get an XML with the video details:$id.xml



If you would like to use thumbnail through pure js/jquery no api, you can use this tool to capture a frame from the video and voila! Insert url thumb in which ever source you like.

Here is a code pen :

<img src=""` alt="" />

Here is the site to get thumbnail:

Using the Vimeo url(, here is my example

<!DOCTYPE html>
<html lang="en" xmlns="">
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <script src="" type="text/javascript"></script>
        <img src="" id="thumbImg">
        $(document).ready(function () {
            var vimeoVideoUrl="";
            var match = /vimeo.*/(d+)/i.exec(vimeoVideoUrl);
            if (match) {
                var vimeoVideoID = match[1];
                $.getJSON('' + vimeoVideoID + '.json?callback=?', { format: "json" }, function (data) {
                    featuredImg = data[0].thumbnail_large;
                    $('#thumbImg').attr("src", featuredImg);

This is a quick crafty way of doing it, and also a way to pick a custom size.

I go here:[VIDEO ID].php

Download the file, open it, and find the 640 pixels wide thumbnail, it will have a format like so:[LONG NUMBER HERE]_640.jpg

You take the link, change the 640 for – for example – 1400, and you end up with something like this:[LONG NUMBER HERE]_1400.jpg

Paste it on your browser search bar and enjoy.


It seems like api/v2 is dead.
In order to use the new API, you need to register your application, and base64 encode the client_id and client_secret as an Authorization header.

    url: '' + video_id,
    dataType: 'json',
    headers: {
        'Authorization': 'Basic ' + window.btoa(client_id + ":" + client_secret);
    success: function(data) {
        var thumbnail_src =[2].link;
        $('#thumbImg').attr('src', thumbnail_src);

For security, you can return the client_id and client_secret already encoded from the server.

I created a CodePen that fetches the images for you.


<input type="text" id="vimeoid" placeholder="257314493" value="257314493">
<button id="getVideo">Get Video</button>
<div id="output"></div>


const videoIdInput = document.getElementById('vimeoid');
const getVideo = document.getElementById('getVideo');
const output = document.getElementById('output');

function getVideoThumbnails(videoid) {
  .then(response => {
    return response.text();
  .then(data => {
    const { thumbnail_large, thumbnail_medium, thumbnail_small } = JSON.parse(data)[0];
    const small = `<img src="${thumbnail_small}"/>`;
    const medium = `<img src="${thumbnail_medium}"/>`;
    const large = `<img src="${thumbnail_large}"/>`;
    output.innerHTML = small + medium + large;
  .catch(error => {

getVideo.addEventListener('click', e => {
  if (!isNaN(videoIdInput.value)) {

enter image description here

function parseVideo(url) {
    // - Supported YouTube URL formats:
    //   -
    //   -
    //   -
    // - Supported Vimeo URL formats:
    //   -
    //   -
    // - Also supports relative URLs:
    //   - //


    if (RegExp.$3.indexOf('youtu') > -1) {
        var type="youtube";
    } else if (RegExp.$3.indexOf('vimeo') > -1) {
        var type="vimeo";

    return {
        type: type,
        id: RegExp.$6

function getVideoThumbnail(url, cb) {
    var videoObj = parseVideo(url);
    if (videoObj.type == 'youtube') {
        cb('//' + + '/maxresdefault.jpg');
    } else if (videoObj.type == 'vimeo') {
        $.get('' + + '.json', function(data) {

Decomposing Karthikeyan P’s answer so it can be used in a wider array of scenarios:

// Requires jQuery

function parseVimeoIdFromUrl(vimeoUrl) {
  var match = /vimeo.*/(d+)/i.exec(vimeoUrl);
  if (match)
    return match[1];

  return null;

function getVimeoThumbUrl(vimeoId) {
  var deferred = $.Deferred();
    '//' + vimeoId + '.json',
        dataType: 'jsonp',
        cache: true
  .done(function (data) {
    // .thumbnail_small 100x75
    // .thumbnail_medium 200x150
    // 640 wide
        var img = data[0].thumbnail_large;
  .fail(function(a, b, c) {
    deferred.reject(a, b, c);
  return deferred;


Get a Vimeo Id from a Vimeo video URL:

var vimeoId = parseVimeoIdFromUrl(vimeoUrl);

Get a vimeo thumbnail URL from a Vimeo Id:

.done(function(img) {
    $('div').append('<img src="' + img + '"/>');

Actually the guy who asked that question posted his own answer.

“Vimeo seem to want me to make a HTTP request, and extract the thumbnail URL from the XML they return…”

The Vimeo API docs are here:

In short, your app needs to make a GET request to an URL like the following:

and parse the returned data to get the thumbnail URL that you require, then download the file at that URL.

I wrote a function in PHP to let me to this, I hope its useful to someone. The path to the thumbnail is contained within a link tag on the video page. This seems to do the trick for me.

    $video_url = ""  
    $file = fopen($video_url, "r");
    $filedata = stream_get_contents($file);
    $html_content = strpos($filedata,"<link rel="videothumbnail");
    $link_string = substr($filedata, $html_content, 128);
    $video_id_array = explode(""", $link_string);
    $thumbnail_url = $video_id_array[3];
    echo $thumbnail_url;

Hope it helps anyone.


function getVimeoInfo($link)
    if (preg_match('~^http://(?:www.)?', $link, $match)) 
        $id = $match[1];
        $id = substr($link,10,strlen($link));

    if (!function_exists('curl_init')) die('CURL is not installed!');
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, "$id.php");
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_TIMEOUT, 10);
    $output = unserialize(curl_exec($ch));
    $output = $output[0];
    return $output;

//at below function pass the thumbnail url.

function save_image_local($thumbnail_url)

         //for save image at local server
         $filename = time().'_hbk.jpg';

         file_put_contents ($fullpath,file_get_contents($thumbnail_url));

        return $filename;

If you don’t need an automated solution, you can find the thumbnail URL by entering the vimeo ID here:

UPDATE: This solution stopped working as of Dec 2018.

I was looking for the same thing and it looks like most answers here are outdated due to Vimeo API v2 being deprecated.

my php 2¢:

$vidID     = 12345 // Vimeo Video ID
$tnLink = json_decode(file_get_contents('' . $vidID))->thumbnail_url;

with the above you will get the link to Vimeo default thumbnail image.

If you want to use different size image, you can add something like:

$tnLink = substr($tnLink, strrpos($tnLink, "") + 1);
$tnLink = substr($tnLink, 0, strrpos($tnLink, '_')); // You now have the thumbnail ID, which is different from Video ID

// And you can use it with link to one of the sizes of crunched by Vimeo thumbnail image, for example:
$tnLink = '' . $tnLink    . '_1280x720.jpg&';

If you are looking for an alternative solution and can manage the vimeo account there is another way, you simply add every video you want to show into an album and then use the API to request the album details – it then shows all the thumbnails and links. It’s not ideal but might help.

API end point (playground)

Twitter convo with @vimeoapi

You might want to take a look at the gem from Matt Hooks.

It provides a simple vimeo wrapper for the api.

All you would need is to store the video_id (and the provider if you are also doing other video sites)

You can extract the vimeo video id like so

  get_vimeo_video_id (link)
        vimeo_video_id = nil
        vimeo_regex  = /http://(www.)?$|/)/
        vimeo_match = vimeo_regex.match(link)

if vimeo_match.nil?
  vimeo_regex  = /[a-z0-9-]+)/
  vimeo_match = vimeo_regex.match(link)

    vimeo_video_id = vimeo_match[2] unless vimeo_match.nil?
    return vimeo_video_id

and if you need you tube you might find this usefull

 get_youtube_video_id (link)
    youtube_video_id = nil
    youtube_regex  = /^(https?://)?(www.)?[A-Za-z0-9._%-]*)(&S+)?/
    youtube_match = youtube_regex.match(link)

if youtube_match.nil?
  youtubecom_regex  = /^(https?://)?(www.)?[A-Za-z0-9._%-]*)(&S+)?/
  youtube_match = youtubecom_regex.match(link)

youtube_video_id = youtube_match[3] unless youtube_match.nil?
return youtube_video_id

2020 solution:

I wrote a PHP function which uses the Vimeo Oembed API.

 * Get video thumbnail URL
 * Set the referer parameter if your video is domain restricted.
 * @param  int    $videoid   Video id
 * @param  URL    $referer   Your website domain
 * @return bool/string       Thumbnail URL or false if can't access the video
function get_vimeo_thumbnail_url( $videoid, $referer=null ){

    // if referer set, create context
    $ctx = null;
    if( isset($referer) ){
        $ctxa = array(
            'http' => array(
                'header' => array("Referer: $refererrn"),
                'request_fulluri' => true,
        $ctx = stream_context_create($ctxa);

    $resp = @file_get_contents("$videoid", False, $ctx);
    $resp = json_decode($resp, true);

return $resp["thumbnail_url"]??false;


echo get_vimeo_thumbnail_url("1084537");

Here is the perfect solution –

   URL Example :
   URL method :{video_id}.jpg

It’s worked for me.

For somebody like me who’s trying to figure this out recently,[video_id]_[dimension].webp works for me.

(where dimension = 200×150 | 640)

Leave a Comment