← Go back to homepage

How to Grab Youtube Video Thumbnail?

How to Grab Youtube Video Thumbnail?

Getting the thumbnail of a Youtube video through it’s ID is not that hard. You just have to transform the URL a little bit to get a high quality JPG file, used as a main thumbnail through Youtube.com.
[ad name=”In Post”]
All Youtube videos have their own unique ID which is 11 charcaters long. A typical Youtube video URL will look like this:

http://www.youtube.com/watch?v=**i3_dOWYHS7I**

The part in bold is the part you are interested in. You can get it by using a simple explode() function.

After you get the ID you just need to point an image to the following URL structure:

http://i2.ytimg.com/vi/**i3_dOWYHS7I**/0.jpg

Where the part in bold should be replaced with the specific video ID.

Using the above video as example will return this image:
How to Grab Youtube Video Thumbnail?

If you want to save it to your server and not hotlink the Youtube servers you can use something like cURL or file_get_contents.

← Go back to homepage