For displaying youtube video thumbnail on your website or wordpress blog either you have to use Youtube’s Video API or there is one simple technique to display youtube video thumbnail on your website.
Display Youtube thumbnail on website
img.youtube.com/vi/VIDEO_ID/#.jpg
You can download thumbnail of any video from youtube using this url format.
VIDEO_ID : is id of the video.
#.jpg : (1.jpg,2.jpg,or 3.jpg)
Default Thumbnail Image, Full-Size (480×360)
img.youtube.com/vi/rNWeBVBqo2c/0.jpg Video Id= rNWeBVBqo2c
1] Thumbnail Image, Small (120×90)
img.youtube.com/vi/rNWeBVBqo2c/1.jpg Video Id= rNWeBVBqo2c
2] Thumbnail Image, Small (120×90)
img.youtube.com/vi/rNWeBVBqo2c/2.jpg Video Id= rNWeBVBqo2c
WordPress Shortcode to Display Youtube Thumbnail
Add following lines of codes in your themes functions.php file to add shorcode code
/* Shortcode to display youtube thumbnail on your wordpress blog. Usage: [youtube_thumb id="VIDEO_ID" img="0" align="left"] VIDEO_ID= Youtube video id img=0,1,2 or 3 align= left,right,center */ function wp_youtube_video_thumbnail($atts) { extract(shortcode_atts(array( 'id' => '', 'img' => '0', 'align'=>'left' ), $atts)); $align_class='align'.$align; return '<img src="/img/spacer.gif">To display Youtube thumbnail on your blog add following shortcode in your wordpress posts/pages
[youtube_thumb id="rNWeBVBqo2c" img="0" align="center"]
which will display image like this
id= Your Video Id
img= 0,1,2,3 any value
align= left,right or centerSome other Examples
[youtube_thumb id="rNWeBVBqo2c" img="1" align="left"]
[youtube_thumb id="rNWeBVBqo2c" img="2" align="right"]
[youtube_thumb id="rNWeBVBqo2c" img="3" align="center"]
Related Posts
Tags: youtube, youtube shortcode, youtube shortcode thumbnail, youtube thumbnail, youtube wp thumb11 Comments on "wordpress display youtube video thumbnail"
-
Vivek Yadav says:December 8, 2011 at 1:20 am
Well, @Alex Why you need to cache image when they are being served from youtube servers which are super fast and CDN based so in a way they’ll be a lot faster than caching them on your server !
-
rakesh says:December 24, 2011 at 6:45 pm
it is good script
Trackbacks for this post
- How to display a thumbnail from a Youtube using a shortcode | WordPress Themes, Plugins, Hacks, Guides
- Hiện Ảnh Thumbnail Của Video YouTube Sử Dụng ShortCode
- How to display a thumbnail from a Youtube using a shortcode
- Youtube Resimlerini Çekme – Wordpress | Samedus
- WORDPRESS HOSTING NEWS » wordpress thumbnail » WORDPRESS HOSTING NEWS
- Hiện Ảnh Thumbnail Của Video YouTube Sử Dụng ShortCode
- How to Display a Thumbnail from a Youtube Using a Shortcode « Blogging Secret
- Display Thumbnail´s From Youtube Video´s | Mypixel.se
Got something to say? Go for it!
Video image is not cached, right? It’s fetched each time the page loads?