WHAT'S NEW?
Loading...

Generate youtube video thumbnail image java script


I created a customize java script from other sources the will generate thumbnail images from youtube.com. It really took me a couple of hour to figure it out, because I was really confuse in different jquery script posted in the net.Now let me teach an easy way on how to generate a thumbnail image based from the given url. Ooops! my mistake! i wont teach you, instead i will show you the whole code including the java script the will generate YouTube thumbnail image.

For example this is your link: http://www.youtube.com/watch?v=HgIzOsMvN9A&feature=related

function getParameter(url) 
{
    var urlparts = url.split('?');
    if (urlparts.length > 1){
        var parameters = urlparts[1].split('&');
        for (var i = 0; i < parameters.length; i++){
            var paramparts = parameters[i].split('=');
            if (paramparts.length > 1) {
                return unescape(paramparts[1]);
            }
        }
    }
    return null;
}
function CreateThumbnail(frm){  
  var url;
  Embed = frm.txtVideoURL.value;
  url=getParameter(Embed);
  alert("http://img.youtube.com/vi/"+url+"/2.jpg");      
 }
<input id="inputVideoURL" name="txtVideoURL"type="text" />
<input name="action"onclick="CreateThumbnail(VideoForm);"type="submit" value="INSERT"/>


As you enter the Youtube video url to the textfield it will call back a url directory where the image thumbnail of Youtube is located.

4 comments : Leave Your Comments

  1. THIS TOPIC IS VERY USEFUL FOR ME AND I GOT MORE INFORMATION FROM THIS SITE

    ReplyDelete
  2. wao nice its really awesome post i get the good information which is very helpful.keep sharing

    ReplyDelete