Google trends Public Holidays Coupon Code Code Compiler

Get YouTube video thumbnail using php

Feb 3, 2019

In this tutorial I will show you how to Get YouTube video thumbnail using php. Make a PHP file to get thumbnail from youtube video. In this step we entered the youtube video url and get value video id by using explode() function which is after the '=' in url. We use youtube image storing subdomain '' and write full path where youtube store its video thumbnail and write '0' which is the default video thumbnail.You can use 0, 1, 2 and 3 for different thumbnails of a particular video.You may also like upload image from url.

PHP Code

  // Enter Video URL
  $videoURL = '';
  $urlArr = explode("=", $videoURL);
  $urlArrNum = $urlArr[1];
   // Generate youtube thumbnail url
  $thumbURL = '' . $urlArrNum . '/0.jpg';
echo '<img src="'.$thumbURL.'">';

That's all, this is how to get thumbnail image from youtube video using PHP.You can customize this code further as per your requirement. And please feel free to give comments on this tutorial.

Copyright 2024. All rights are reserved