Ver Mensaje Individual
  #8 (permalink)  
Antiguo 23/08/2012, 03:32
Avatar de ahaugas
ahaugas
 
Fecha de Ingreso: agosto-2011
Ubicación: Madrid
Mensajes: 249
Antigüedad: 12 años, 8 meses
Puntos: 21
Respuesta: Cambiar medidas <iframe>

si convertirlo esta bien, porque youtube te da tres maneras

La primera:
<iframe width="420" height="315" src="http://www.youtube.com/embed/XXXXXXX" frameborder="0" allowfullscreen></iframe>

La segunda:
http://www.youtube.com/watch?v=XXXXXXX

la tercera:
http://youtu.be/XXXXXXX

seria buscar como dije antes, pero vamos a simplificar a recibir solo la id
Código PHP:
Ver original
  1. <?php  
  2.  $original = "http://www.youtube.com/watch?v=XXXXXXX";
  3.  $buscar = array('http://www.youtube.com/watch?v=','http://youtu.be/');                                  
  4.  $modificado = str_replace($buscar,'', $original);
  5.  ?>
  6.  
  7. <iframe width="560" height="315" src="http://www.youtube.com/embed/<?php echo $modificado; ?>" frameborder="0" allowfullscreen></iframe>

de esta manera solo obtienes la id y solo tienes que crear el iframe cuando lo saques de la base de datos, con la altura y anchura ya fijas