Welcome

All in one resource for most usable codes in programming in PHP, HTML, JS, CSS.

stackMyCode

All in one resource for most usable codes in programming in PHP, HTML, JS, CSS.

New Technology

We are providing you the most newable resh technologies for you.

Tech News

stackMyCode is allways looking for tech news in computer world. If we found a good news stackMyCode will update you with Tech news.

Monday, November 11, 2013

How to get thumbnails from youtube video

Get thumbnails from youtube video


If you are developing youtube video integrated own video site with video thumbnails or do you want list some youtube videos with video thumbnails you can use this script with php and json

Use the data on server-side using PHP

<?php

$json = json_decode(file_get_contents("http://gdata.youtube.com/feeds/api/videos/<youtube-video-id-here>?v=2&alt=jsonc"));
echo '<img src="' . $json->data->thumbnail->sqDefault . '">';

?>



Replace <youtube-video-id-here> with your youtube video IDs.