Ver Mensaje Individual
  #7 (permalink)  
Antiguo 13/09/2009, 19:29
Avatar de Pedro_valencia
Pedro_valencia
 
Fecha de Ingreso: diciembre-2007
Ubicación: Valencia
Mensajes: 82
Antigüedad: 16 años, 4 meses
Puntos: 6
Respuesta: reducir imagenes

Prueba con este script que programé hace tiempo para la web de una clienta:

Código PHP:
<?php
$path 
$_GET['i']; // Ruta de la imagen original
if(file_exists($path)) // Cargamos la imagen seleccionada y la redimensionamos
$image imagecreatefromstring(file_get_contents($path));
else
$image imagecreatefromstring(file_get_contents('sinimagen.gif')); 
  
$path 'sinimagen.gif';
endif;
$w imagesx($image) +4;
$h imagesy($image) +4;
list(
$width,$height)=getimagesize($path);
$ancho=$_GET['an']; // Recibimos el parámetro del ancho deseado
$alto=$_GET['al'];
$tmp=imagecreatetruecolor($ancho,$alto);
imagecopyresampled($tmp,$image,0,0,0,0,$ancho+4,$alto+4,$w,$h);
header ("Content-type: image/png");
imagepng($tmp);
?>
Si te refieres a reducir el tamaño al subirla, dimelo y te posteo el otro código.

Un saludo y suerte!; Si este post te ha servido, ¡dame karma, es gratis!
__________________
Si te ha servido mi post, ¡dame Karma, es gratis!

- ¿Qué es el éxito? Lo diferente.