Ver Mensaje Individual
  #7 (permalink)  
Antiguo 13/07/2004, 09:13
simonurzua
 
Fecha de Ingreso: julio-2004
Mensajes: 3
Antigüedad: 22 años, 2 meses
Puntos: 0
Mejorar la calidad de imagen

Mira, la funcion ImageCopyResampled() te va a permitir dejar las imagenes con una calidad óptima... Aquí te dejo un ejemplo que ocupé para una página:


Código PHP:
if ($tipo == "servicios"){

    if (!
file_exists($direccion)) { $direccion = $carfotos . "nech.jpg";}


    
$fuente     = @imagecreatefromjpeg("administracion/fotos/$id"); 
    
$imgAncho = imagesx ($fuente); 
    
$imgAlto    = imagesy($fuente); 

    if (
$imgAlto == $imgAncho){$alto = 150; $ancho = 150;}
    if (
$imgAncho > $imgAlto){$ancho = 150; $alto = $ancho * $imgAlto / $imgAncho;}
    if (
$imgAlto > $imgAncho){$alto = 150; $ancho = $alto * $imgAncho / $imgAlto;}


    
$imagen = ImageCreateTrueColor($ancho, $alto);
    
ImageCopyResampled($imagen, $fuente, 0, 0, 0, 0, $ancho, $alto, $imgAncho, $imgAlto); 
    
imageJpeg($imagen, '', 70); 

} 

Última edición por simonurzua; 13/07/2004 a las 09:30