Solved

Get Thumbnails from Vimeo

Posted on 2010-11-21
2
1,850 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
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…

911 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

19 Experts available now in Live!

Get 1:1 Help Now