Gaga Rigs

Getting YouTube video screenshot

originally taken from here

http://jquery-howto.blogspot.com/2009/02/how-to-get-youtube-video-screenshot.html

A great little way of getting the any video link from a youtube video
cool uses


<script type="text/javascript"> function getScreen( url, size ) {
if(url === null){
return ""; } size = (size === null) ? "big" : size; var vid; var results;

 results = url.match("[\\?&]v=([^&#]*)");

 vid = ( results === null ) ? url : results[1];

 if(size == "small"){
 return "http://img.youtube.com/vi/"+vid+"/2.jpg"; }
 else {
 return "http://img.youtube.com/vi/"+vid+"/0.jpg"; }
 }

</script>

<?php  $message = "http://www.youtube.com/watch?v=iIp7OnHXBlo";
echo $message;
 ?>

<script type="text/javascript">

var imgUrl_big = getScreen("<?php echo $message ?>");
var imgUrl_small = getScreen("<?php echo $message ?>", 'small');

document.write('<img src="' + imgUrl_big + '" />');
document.write('<img src="' + imgUrl_small + '" />');

</script>

2 Responses to Getting YouTube video screenshot

  1. Sancho says:

    Hi! How can I use it on my blog? I would like to insert a script to every pages of the http://www.salsatune.hu witch create a thumbnail from the embedded YouTube video by automatically.

  2. ^ says:

    Howdy. Someone said some with this different posts plus needed to have an understanding of any time you could be interested in exchanging blogroll one-way links?

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>