How to download YouTube Video thumbnails?

Do you want to download any youtube video thumbnail in your local computer then you can follow simple steps to get youtube video thumbnail in HD and other low quality version and add in your blogpost and other things.

The urls from where you can get the thumbnails are shown below. Each video generates around 4-5 standard thumbnails. The first image is a full size HD image while others are smaller thumbnail images. You can easily try the following urls in the browser by replacing the ‘youtube-video-id’ part with the corresponding videos id.

Default thumbnail URL.
http://img.youtube.com/vi/youtube-video-id/default.jpg

Standard quality version:
http://img.youtube.com/vi/youtube-video-id/sddefault.jpg

Medium quality version:
http://img.youtube.com/vi/youtube-video-id/mqdefault.jpg

High quality version:
http://img.youtube.com/vi/youtube-video-id/hqdefault.jpg

Maximum quality version:
http://img.youtube.com/vi/youtube-video-id/maxresdefault.jpg

There are lot’s of free online youtube thumbnail download tools which you can use to instantly download thumbnails. just follow these steps:

  1. Copy the Youtube Video URL
  2. Go to Youtube Video Thumbnail Downloader
  3. Paste the Youtube Video URL in the input box.
  4. Now just download the thumbnail image of the desired quality (medium, standard, high and original).

PHP YouTube thumbnail Downloader Script

Download YouTube Video thumbnails Via PHP Code.

/ Set YouTube video id here
 
function($video_id) { 
 
// Set path where to store thumbnails,
// Set this to a blank string to save in the current direcrory.
$path_to_save_thumbnails = '/youtube-thumbs/';
// Nothing to change below this
$ch = curl_init();
// Thumbnail types
$thubnail_types = array('default',
                      'sddefault', 'mqdefault',
                      'hqdefault', 'maxresdefault');
 
foreach($thubnail_types as $type) 
{
    $youtube_thumb_url = 'http://img.youtube.com/vi/'.$video_id.'/'.$type.'.jpg';
 
    echo "Downloading thumbnail [$type]." . PHP_EOL;
    // set URL and other appropriate options
    curl_setopt($ch, CURLOPT_URL, $youtube_thumb_url);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
 
    $image = curl_exec($ch);
    $info = curl_getinfo($ch);
 
    // If image is found than save it to a file.
    if($info['http_code'] == 200) {
        // Store thumbnails in the given directory, change this
        // to your liking.
        file_put_contents($path_to_save_thumbnails.$type.'.jpg', $image);
    }
}
echo 'Success';
// close cURL resource, and free up system resources
curl_close($ch);
}

Posted in PHP