How To Get YouTube Thumbnail Images

By | March 7, 2012

YouTube thumbnails can be fetched using YouTube’s Video API. YouTube API responses may contain multiple thumbnail images for a video, each of which is identified by a <media:thumbnail> tag. In order to view or download the thumbnail from a YouTube video.

Change the following video id in the URL to fetch the image

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

The video ID can be found from the video URL after the character v. YouTube automatically generates 4 images for every video .Change the # corresponds to (0, 1, 2, or 3) to get different images.

1st, 2nd, 3rd Thumbnail Image, Small (120×90)

http://img.youtube.com/vi/4Uxs04AG6Zk/1.jpg

http://img.youtube.com/vi/4Uxs04AG6Zk/2.jpg

http://img.youtube.com/vi/4Uxs04AG6Zk/3.jpg

YouTube thumbnails Image can be fetched using custom field in WordPress. Custom field function code

<img border="0" src="http://img.youtube.com/vi/<?php $youtubes = get_post_meta($post->ID, 'youtube', false); ?>
	
		<?php foreach($youtubes as $tube ) {
			echo $tube;
			} ?>/1.jpg"  rel="nofollow" alt="Thumbnail" />

Example Here

Leave a Reply

Your email address will not be published. Required fields are marked *

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.