Posted By

mrwolfgraphics on 11/30/10


Tagged


Versions (?)

Who likes this?

8 people have marked this snippet as a favorite

luman
kwameboame
warren
virendrakryadav
jondiscipulo
Balamir
victorcastelan
ringo380


get the jQuery YouTube Thumbnail


 / Published in: jQuery
 

URL: http://jquery-howto.blogspot.com/2009/05/jyoutube-jquery-youtube-thumbnail.html

  1. $.extend({
  2. jYoutube: function( url, size ){
  3. if(url === null){ return ""; }
  4.  
  5. size = (size === null) ? "big" : size;
  6. var vid;
  7. var results;
  8.  
  9. results = url.match("[\\?&]v=([^&#]*)");
  10.  
  11. vid = ( results === null ) ? url : results[1];
  12.  
  13. if(size == "small"){
  14. return "http://img.youtube.com/vi/"+vid+"/2.jpg";
  15. }else {
  16. return "http://img.youtube.com/vi/"+vid+"/0.jpg";
  17. }
  18. }
  19. });

Report this snippet  

You need to login to post a comment.