How to Get YouTube Video Image Thumbnails
How to get your youtube video image thumbs. Use this in your project when you need the image thumb generated by Youtube in your projects.
In order to get the video thumbnails that YouTube generates we can use the following links.
http://img.youtube.com/vi/<insert-youtube-video-id-here>/0.jpg http://img.youtube.com/vi/<insert-youtube-video-id-here>/1.jpg http://img.youtube.com/vi/<insert-youtube-video-id-here>/2.jpg http://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg
These are high resolutions, medium quality, standard definition, and maximum resolution.
http://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg //normal resolution http://img.youtube.com/vi/<insert-youtube-video-id-here>/hqdefault.jpg //high quality resolution http://img.youtube.com/vi/<insert-youtube-video-id-here>/mqdefault.jpg //medium quality resolution http://img.youtube.com/vi/<insert-youtube-video-id-here>/sddefault.jpg //standard definition http://img.youtube.com/vi/<insert-youtube-video-id-here>/maxresdefault.jpg //maximum resolution
To get the YouTube Video ID you can just retrieve the link. For Example:
https://www.youtube.com/watch?v=hfjNjOOB6Sk The ID of the Video is: hfjNjOOB6Sk
This is the PHP script that i use to get the ID of the video
<?php $videoThumb = str_replace(array('https://www.youtube.com/watch?v=', 'http://www.youtube.com/watch?v='), '', $videos['url']); ?>
Enjoy!