Get Image and Data Youtube Return Json Data

API URL Youtube Get Thumbnail Image From YouTube

// [ Abstract Codify ] Abstractcodify.com All Rights Reserved.
/*
// API URL Youtube Get Thumbnail Image From YouTube
// # (1,2, or 3) and 0 image Full-Size

http://img.youtube.com/vi/VIDEO_ID/#.jpg

//--------------------------------------------------------------- 

Open these URLs in your browser to find out:

http://gdata.youtube.com/feeds/api/videos/gzDS-Kfd5XQ?v=2&prettyprint=true
http://gdata.youtube.com/feeds/api/videos/gzDS-Kfd5XQ?v=2&prettyprint=true&alt=json
http://gdata.youtube.com/feeds/api/videos/gzDS-Kfd5XQ?v=2&prettyprint=true&alt=jsonc

gzDS-Kfd5XQ is the Id of the video.
I recommend the 3rd one because it has the smallest footprint
Use the data on client side using vanilla JavaScript
*/

<script type="text/javascript">
    function youtubeFeedCallback(json){
        document.write('<img src="' + json.data.thumbnail.sqDefault + '"/>');
    }

<script type="text/javascript" src="http://gdata.youtube.com/feeds/api/videos/gzDS-Kfd5XQ?v=2&alt=jsonc&callback=youtubeFeedCallback"></script>

    
//---------------------------------------------------------------    
    
    
<script type="text/javascript">    
//Use the data on client side using jQuery  
$.getJSON("http://gdata.youtube.com/feeds/api/videos/gzDS-Kfd5XQ?v=2&alt=jsonc&callback=?", function(json){
    $("<img />").attr("src", json.data.thumbnail.sqDefault).appendTo("body");
});
</script>

    
//---------------------------------------------------------------       
    
    
// Use the data on server-side using PHP
$json = json_decode(file_get_contents("http://gdata.youtube.com/feeds/api/videos/gzDS-Kfd5XQ?v=2&alt=jsonc"));
echo '<img src="' . $json-/>data->thumbnail->sqDefault . '">';

Reference URL