thumbnail_large; break; } return $src; } public static function parseVimeoUrl($url) { $urls = parse_url($url); // https://vimeo.com/274720181 if($urls['host'] == 'vimeo.com'){ $id = ltrim($urls['path'],'/'); } // https://player.vimeo.com/video/274720181 else { $parts = explode('/',$urls['path']); $id = end($parts); } return $id; } public static function parseYoutubeUrl($url) { $urls = parse_url($url); //url is http://youtu.be/xxxx if($urls['host'] == 'youtu.be'){ $id = ltrim($urls['path'],'/'); } //url is http://www.youtube.com/embed/xxxx else if(strpos($urls['path'],'embed') == 1){ $parts = explode('/',$urls['path']); $id = end($parts); } //url is xxxx only else if(strpos($url,'/')===false){ $id = $url; } //http://www.youtube.com/watch?feature=player_embedded&v=m-t4pcO99gI //url is http://www.youtube.com/watch?v=xxxx else{ parse_str($urls['query']); /* @var $v */ $id = $v; if(!empty($feature)){ $id = end(explode('v=',$urls['query'])); } } return $id; } }