This option will reset the home page of this site. Restoring any closed widgets or categories.

Reset

Get youtube video screenshot using simple php and javascript

Simple script to get the screenshot of a particular URL from youtube,

<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  $url = "http://www.youtube.com/watch?v=hQVTIJBZook";
echo $url;
 ?>
<script type="text/javascript">
var imgUrlbig = getScreen("< ?php echo $url ?>");
var imgUrlsmall = getScreen("< ?php echo $url ?>", 'small');
document.write('<img src="' + imgUrlbig + '" />');
document.write('<img src="' + imgUrlsmall + '" />');
</script>
VN:F [1.5.7_846]
Rating: 8.4/10 (7 votes cast)
VN:F [1.5.7_846]
Rating: 0 (from 0 votes)

Related posts:

  1. Embedding youtube video in wordpress
  2. Javascript Events A Complete Video Tutorial With Yahoo
  3. Simple Ajax with PHP click tracker

1 Comment

  1. Earle Maasch says:

    Fantastic post mate, helped me out a lot. Keep up the great posts.

    VA:F [1.5.7_846]
    Rating: 3.0/5 (1 vote cast)
    VA:F [1.5.7_846]
    Rating: 0 (from 0 votes)

Leave a Reply

Comments (required)

Spam Protected