get the jQuery YouTube Thumbnail


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your 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. });

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.