January 3, 2016

PHP - How to get YouTube video image from YouTube URL?




- When I face this problem to display YouTube video image display from URL/link, then I find one solution as below:

- For each YouTube have unique video ID so you can get 5 type of images using that ID,

- Here I explain with example for all type of YouTube images how to display?

1. For video default image but not high resolution of image:

   http://img.youtube.com/vi/<YouTube-Video-Unique-ID>/default.jpg


2. For the high resolution of image use below link:

   http://img.youtube.com/vi/<YouTube-Video-Unique-ID>/hqdefault.jpg


3. For the medium quality of the thumbnail image use below example:

   http://img.youtube.com/vi/<YouTube-Video-Unique-ID>/mqdefault.jpg


4. For the standard version of the image use a link similar to this:

   http://img.youtube.com/vi/<YouTube-Video-Unique-ID>/sddefault.jpg


5. For the maximum resolution of the video thumbnail image use a url like this:

   http://img.youtube.com/vi/<YouTube-Video-Unique-ID>/maxresdefault.jpg

- And one more thing for above all URLs you can also used https instead of http.

Enjoy!

No comments:

Post a Comment

The Future of Technology: Emerging Trends to Watch in 2025

Introduction As we navigate through 2025, the technological landscape continues to evolve at an unprecedented pace. Innovations that once se...