Solved

Get Thumbnails from Vimeo

Posted on 2010-11-21
2
1,842 Views
Last Modified: 2012-05-10
Have a simple video gallery on my site created with classic asp.
Database contains video title and the video url from vimeo.

I have been able to get the actual video to display but not sure how to get the thumbnails for the videos.

I have a page which shoud list my video titles with thumbnails.
There is a method to get the url of the thumbnails:
http://vimeo.com/api/docs/methods/vimeo.videos.getThumbnailUrls
but I don't know how I get to use the actual url which is returned.  

0
Comment
Question by:harris9999
2 Comments
 
LVL 20

Accepted Solution

by:
Proculopsis earned 500 total points
ID: 34186062

The json format response should drop into your javascript nicely, as in the following simulation:

<html>
<head>
<title>http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q__26630467.html</title>

<script>

window.onload = function()
{
  var vimeo;
  eval( "vimeo = " + document.getElementById("thumbnail").innerHTML );

  var image = new Image();
  image.src = vimeo.thumbnail[2]._content;
  image.height = vimeo.thumbnail[2].height;
  image.width = vimeo.thumbnail[2].width;

  document.body.appendChild( image );
}
</script>

<style>
#code { width: 145px; height: 100px; border: 1px solid red; }
</style>

</head>

<body>

vimeo.videos.getThumbnailUrls<br />
JSON<br />
Response<br />
<div id="code">
<pre id="thumbnail" >
{
  "thumbnail":[
    {
      "height":"75",      "width":"100",      "_content":"http://www.opendns.com/dashboard/img/placeholder_md.gif"    },
    {
      "height":"150",      "width":"200",      "_content":"http://www.opendns.com/dashboard/img/placeholder_md.gif"    },
    {
      "height":"200",      "width":"300",      "_content":"http://www.opendns.com/dashboard/img/placeholder_sm.gif"    }
  ]
}
</pre>
<div>

</body>

</html>

Open in new window

0
 
LVL 3

Author Comment

by:harris9999
ID: 34187376
Ok I kind of undertsand how that works.
Now trying to combine it all.
Code started with below. Been playing with it but unsuccessful so far to get the thumbnails from the vimeo urls.
<html>

<head>

<title>http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q__26630467.html</title>



<script>



window.onload = function()

{

  var vimeo;

  eval( "vimeo = " + document.getElementById("thumbnail").innerHTML );



  var image = new Image();

  image.src = vimeo.thumbnail[0]._content;

  image.height = vimeo.thumbnail[0].height;

  image.width = vimeo.thumbnail[0].width;



  document.body.appendChild( image );

}

</script>



<style>

.video{ margin-bottom:20px;}

#code { width: 145px; height: 100px; border: 1px solid red; }

</style>



</head>



<body>



vimeo.videos.getThumbnailUrls<br />

JSON<br />

Response<br />

<div id="code">

<pre id="thumbnail" >

{

  "thumbnail":[

    {

      "height":"75",      "width":"100",      "_content":"http://www.opendns.com/dashboard/img/placeholder_md.gif"    },

    {

      "height":"150",      "width":"200",      "_content":"http://www.opendns.com/dashboard/img/placeholder_md.gif"    },

    {

      "height":"200",      "width":"300",      "_content":"http://www.opendns.com/dashboard/img/placeholder_sm.gif"    }

  ]

}

</pre>

</div>

<%

dim vidtitle(3)

vidtitle(1)="Video 1"

vidtitle(2)="Video 2"

vidtitle(3)="Video 3"



dim vidurl(3)

vidurl(1)="http://vimeo.com/11436985"

vidurl(2)="http://vimeo.com/16871362"

vidurl(3)="http://vimeo.com/16894558"





for i=1 to 3

%>



<div class="video">

	<div class="videotitle"><%=vidtitle(i)%></div>

	<div class="videotitle"><%=vidurl(i)%></div>

	<div class="videothumbnail"></div>

</div>



<%

next

%>



</body>



</html>

Open in new window

0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now