Get youtube video screenshot using simple php and javascript

This Tutorial Has Been Viewed 4,374 Times.

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.9.13_1145]
Rating: 7.4/10 (16 votes cast)
VN:F [1.9.13_1145]
Rating: +1 (from 3 votes)

Get youtube video screenshot using simple php and javascript, 7.4 out of 10 based on 16 ratings

Incoming search terms:





You will also be interested in ,

Tags: ,

One Response

  1. Earle Maasch says:

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

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

Leave a Reply

Spam protection by WP Captcha-Free

Proudly designed by Mistonline.in.
Affordable Seo PackagesSeo BlogEdu Backlinks
More in PHP (69 of 122 articles)