Thursday, 7 August 2014

Get thump image from youtube link

<?php
$url = "YOU_TUBE_URL";   //Ex Youtube link: https://www.youtube.com/watch?v=vL-c_RtYkBE
$queryString = parse_url($url, PHP_URL_QUERY);
parse_str($queryString, $params);
$v = $params['v'];  
if(strlen($v)>0){
 echo "<img src='http://i3.ytimg.com/vi/$v/default.jpg' />";
 echo "<img src='http://i3.ytimg.com/vi/$v/hqdefault.jpg' />";
 echo "<img src='http://i3.ytimg.com/vi/$v/mqdefault.jpg' />";
 echo "<img src='http://i3.ytimg.com/vi/$v/maxresdefault.jpg' />";
}
?>

No comments:

Post a Comment