/ Published in: PHP
Parses various types of YouTube URLs returning the embed iframe with optional width and height
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function getEmbedYT($link, $width=430, $height=230){ $final = '<iframe width="'.$width.'" height="'.$height.'" src="http://www.youtube.com/embed/{code}" frameborder="0"></iframe>'; //se o link for o embed (altera o width e height) return $link; } //link URL $code = $args['v']; }//link do embbed }//short link elseif($parsed['host'] == 'youtu.be'){ } if($code){ return $final; }else{ return null; } }