Skip to main content
Active reading [<http://en.wikipedia.org/wiki/PHP> <http://en.wikipedia.org/wiki/YouTube>]. In English, the subjective form of the singular first-person pronoun, "I", is capitalized, along with all its contractions such as I'll and I'm.
Source Link
Peter Mortensen
  • 31.4k
  • 22
  • 110
  • 134

aA simple phpPHP function iI created for the youtubeYouTube thumbnail and the types are

  • default

    default
  • hqdefault

    hqdefault
  • mqdefault

    mqdefault
  • sddefault

    sddefault
  • maxresdefault

     function get_youtube_thumb($link,$type){
    
         $video_id = explode("?v=", $link); 
             if (empty($video_id[1])){
                $video_id = explode("/v/", $link); 
                $video_id = explode("&", $video_id[1]); 
                $video_id = $video_id[0];
             }
         $thumb_link = "";
         if($type == 'default' || $type == 'hqdefault' || $type == 'mqdefault' || $type == 'sddefault' || $type == 'maxresdefault'){
    
             $thumb_link = 'http://img.youtube.com/vi/'.$video_id.'/'.$type.'.jpg';
    
         }elseif($type == "id"){
             $thumb_link = $video_id;
         }
         return $thumb_link;}
    
    maxresdefault

 

function get_youtube_thumb($link,$type){

    $video_id = explode("?v=", $link);

    if (empty($video_id[1])){
        $video_id = explode("/v/", $link);
        $video_id = explode("&", $video_id[1]);
        $video_id = $video_id[0];
    }
    $thumb_link = "";

    if($type == 'default'   || $type == 'hqdefault' ||
       $type == 'mqdefault' || $type == 'sddefault' ||
       $type == 'maxresdefault'){

        $thumb_link = 'http://img.youtube.com/vi/'.$video_id.'/'.$type.'.jpg';

    }elseif($type == "id"){
        $thumb_link = $video_id;
    }
    return $thumb_link;}

a simple php function i created for the youtube thumbnail and the types are

  • default

  • hqdefault

  • mqdefault

  • sddefault

  • maxresdefault

     function get_youtube_thumb($link,$type){
    
         $video_id = explode("?v=", $link); 
             if (empty($video_id[1])){
                $video_id = explode("/v/", $link); 
                $video_id = explode("&", $video_id[1]); 
                $video_id = $video_id[0];
             }
         $thumb_link = "";
         if($type == 'default' || $type == 'hqdefault' || $type == 'mqdefault' || $type == 'sddefault' || $type == 'maxresdefault'){
    
             $thumb_link = 'http://img.youtube.com/vi/'.$video_id.'/'.$type.'.jpg';
    
         }elseif($type == "id"){
             $thumb_link = $video_id;
         }
         return $thumb_link;}
    

A simple PHP function I created for the YouTube thumbnail and the types are

  • default
  • hqdefault
  • mqdefault
  • sddefault
  • maxresdefault

 

function get_youtube_thumb($link,$type){

    $video_id = explode("?v=", $link);

    if (empty($video_id[1])){
        $video_id = explode("/v/", $link);
        $video_id = explode("&", $video_id[1]);
        $video_id = $video_id[0];
    }
    $thumb_link = "";

    if($type == 'default'   || $type == 'hqdefault' ||
       $type == 'mqdefault' || $type == 'sddefault' ||
       $type == 'maxresdefault'){

        $thumb_link = 'http://img.youtube.com/vi/'.$video_id.'/'.$type.'.jpg';

    }elseif($type == "id"){
        $thumb_link = $video_id;
    }
    return $thumb_link;}
Source Link
Arun Yokesh
  • 1.4k
  • 17
  • 19

a simple php function i created for the youtube thumbnail and the types are

  • default

  • hqdefault

  • mqdefault

  • sddefault

  • maxresdefault

     function get_youtube_thumb($link,$type){
    
         $video_id = explode("?v=", $link); 
             if (empty($video_id[1])){
                $video_id = explode("/v/", $link); 
                $video_id = explode("&", $video_id[1]); 
                $video_id = $video_id[0];
             }
         $thumb_link = "";
         if($type == 'default' || $type == 'hqdefault' || $type == 'mqdefault' || $type == 'sddefault' || $type == 'maxresdefault'){
    
             $thumb_link = 'http://img.youtube.com/vi/'.$video_id.'/'.$type.'.jpg';
    
         }elseif($type == "id"){
             $thumb_link = $video_id;
         }
         return $thumb_link;}