Ver Mensaje Individual
  #3 (permalink)  
Antiguo 15/02/2006, 10:12
Avatar de miglos
miglos
 
Fecha de Ingreso: enero-2005
Ubicación: Perú
Mensajes: 235
Antigüedad: 21 años, 8 meses
Puntos: 1
Todavia sigo vivo! casi 14 horas pegado a la panatalla! Bueno, ojala te sirva este script, que lo consegui de un libro, tu eliges el tamaño en el que quieras mostrar la imagen.
Código PHP:
<?php

$image 
= $HTTP_GET_VARS['image'];

if (!
$max_width)
  
$max_width = 80;
if (!
$max_height)
  
$max_height = 60;

$size = GetImageSize($image);
$width = $size[0];
$height = $size[1];

$x_ratio = $max_width / $width;
$y_ratio = $max_height / $height;

if ( (
$width <= $max_width) && ($height <= $max_height) ) {
  
$tn_width = $width;
  
$tn_height = $height;
}
else if ((
$x_ratio * $height) < $max_height) {
  
$tn_height = ceil($x_ratio * $height);
  
$tn_width = $max_width;
}
else {
  
$tn_width = ceil($y_ratio * $width);
  
$tn_height = $max_height;
}

$src = ImageCreateFromJpeg($image);
$dst = ImageCreate($tn_width,$tn_height);
ImageCopyResized($dst, $src, 0, 0, 0, 0,
    
$tn_width,$tn_height,$width,$height);
header('Content-type: image/jpeg');
ImageJpeg($dst, null, -1);
ImageDestroy($src);
ImageDestroy($dst);

?>
, para este ejemplo, la imagen resultante quedara a 80 x 60, siempre tratara de mantener una proporcion entre el ancho-largo original.
La carga de imagenes la haras via FTP??? Si tienes algun codigo, me avisas, pq tambien estoy trabajando en algo similar, o si no, pues aqui estamos, por aqui tengo uno, pero que a veces me da problemas,
Espero te haya sido de ayuda, saludos.
__________________
:adios: