Foros del Web » Programando para Internet » PHP »

Redimensionar imagen

Estas en el tema de Redimensionar imagen en el foro de PHP en Foros del Web. Hola a todos Tengo el siguiente código: <td > ... <?php echo $img; ?> ... </td> Lo que quiero hacer es reducir a la mitad ...
  #1 (permalink)  
Antiguo 05/09/2008, 10:36
 
Fecha de Ingreso: abril-2008
Mensajes: 81
Antigüedad: 16 años
Puntos: 0
Pregunta Redimensionar imagen

Hola a todos


Tengo el siguiente código:

<td >
...
<?php echo $img; ?>
...
</td>


Lo que quiero hacer es reducir a la mitad las dimensiones de la imagen. Para ello he probado varias alternativas, pero ninguna me funciona

1)

<img src =<?php echo $img; ?> height="50%" width ="50%">;

2)

<?php
$medida = GetImageSize($img);
$medVert= $medida [1]/2;
$medHoriz= $medida [0]/2;
?>

<img src = $img height=$medVert width =$medHoriz>



¿Pueden echarme una mano?

Gracias anticipadas

Luisa
  #2 (permalink)  
Antiguo 05/09/2008, 10:46
Avatar de GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Respuesta: Redimensionar imagen

Código PHP:
<img src="<?php echo $img?>" height="<?php echo $medVert?>" width="<?php echo $medHoriz?>">
Saludos.
  #3 (permalink)  
Antiguo 05/09/2008, 12:35
 
Fecha de Ingreso: abril-2008
Mensajes: 81
Antigüedad: 16 años
Puntos: 0
Respuesta: Redimensionar imagen

Gracias, GatorV


Sigue sin funcionar...


me aparece esto en el formulario:


" height="0" width="0">


Luisa
  #4 (permalink)  
Antiguo 05/09/2008, 12:41
Avatar de Ronruby  
Fecha de Ingreso: julio-2008
Ubicación: 18°30'N, 69°59'W
Mensajes: 4.879
Antigüedad: 15 años, 9 meses
Puntos: 416
Respuesta: Redimensionar imagen

list($width, $height) = getimagesize($img);
$width_n = ($width/2);
$height_n = ($width/2);

<img src="<?php echo $img; ?>" height="<?php echo $height_n; ?>" width="<?php echo $width_n; ?>"></img>

Y revisa que la ruta a la imagen este correcta.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 10:45.