YouTube offers images that don't have the 4:3 ratio black strips. To get a 16:9 video thumbnail with no black strips, try one of these:
http://img.youtube.com/vi/<insert-youtube-video-id-here>/mqdefault.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/maxresdefault.jpg
For other YouTube thumbnail option you can use following.
http://img.youtube.com/vi/<insert-youtube-video-id-here>/mqdefault.jpg
http://img.youtube.com/vi/<insert-youtube-video-id-here>/maxresdefault.jpg
For other YouTube thumbnail option you can use following.
https://img.youtube.com/vi/<insert-youtube-video-id-here>/3.jpg
==================
Get Video ID in WordPress
$video_link = get_field('youtube_video',get_the_ID());
if (preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $video_link, $match)){
$video_id = $match[1];
}
==================
Get Video ID in WordPress
$video_link = get_field('youtube_video',get_the_ID());
if (preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $video_link, $match)){
$video_id = $match[1];
}
No comments:
Post a Comment