Ver Mensaje Individual
  #3 (permalink)  
Antiguo 29/04/2013, 13:23
Avatar de Triby
Triby
Mod on free time
 
Fecha de Ingreso: agosto-2008
Ubicación: $MX->Gto['León'];
Mensajes: 10.106
Antigüedad: 16 años, 7 meses
Puntos: 2237
Respuesta: Alguien de aqui tiene un foro o pagina que convierta las urls?

A ver si esto funciona:

Código PHP:
Ver original
  1. function youtubeIframe($url) {
  2.     $code = '';
  3.     $match = preg_match("#(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=v\/)[^&\n]+(?=\?)|(?<=v=)[^&\n]+|(?<=youtu.be/)[^&\n]+#", $url, $matches);
  4.     if((int) $match > 0) {
  5.           $video = $matches[0];
  6.           $code .= "<iframe class=\"youtube-player\" type=\"text/html\" width=\"640\" height=\"480\" ";
  7.           $code .= "src=\"http://www.youtube.com/embed/$video\" frameborder=\"0\"></iframe>\n";
  8.  
  9.     }
  10.     return $code;
  11. }
__________________
- León, Guanajuato
- GV-Foto