get youtube thumbnail code example
Example 1: youtube video image
<!-- thumbnail -->
https:
<!-- Others -->
https:
https:
https:
https:
https:
Example 2: how toget image from a youtube video url
| Thumbnail Name | Size (px) | URL |
|---------------------|-----------|--------------------------------------------------|
| Player Background | 480x360 | https:
| Start | 120x90 | https:
| Middle | 120x90 | https:
| End | 120x90 | https:
| High Quality | 480x360 | https:
| Medium Quality | 320x180 | https:
| Normal Quality | 120x90 | https:
Example 3: get term thumbnail
$image_id = get_term_meta( $term->term_id, 'thumbnail_id', true );
$post_thumbnail_img = wp_get_attachment_image_src( $image_id, 'large' );
echo '<img src="' . $post_thumbnail_img[0] . '" alt="' . $term->name . '" />';
Example 4: How do I get a YouTube video thumbnail from the YouTube API?
$data = file_get_contents("https://www.googleapis.com/youtube/v3/videos?key=YOUR_API_KEY&part=snippet&id=T0Jqdjbed40");
$json = json_decode($data);
var_dump($json->items[0]->snippet->thumbnails);