Re: Problema al generar imagenes automaticamente
| From: | desa15 at necso dot es | Date: | Thu, 02 Oct 2003 09:31:26 +0000 |
| Subject: | Re: Problema al generar imagenes automaticamente | ||
| Groups: | php.general.es | ||
| Request: | Send a blank email to general-es+get-41180@lists.php.net to get a copy of this message | ||
Cual es la librería que usas ImageMagick, NetBPM, GD ????
Creo que usas GD, quita la comprobación de GD2 y apañate la función que
pirula bien.
function resize_image_gd($src, $dest, $quality, $width, $height,
$image_info) {
global $convert_options;
$types = array(1 => "gif", 2 => "jpeg", 3 => "png");
if (defined('CONVERT_IS_GD2') && CONVERT_IS_GD2 == 1) {
$thumb = imagecreatetruecolor($width, $height);
}
else {
$thumb = imagecreate($width, $height);
}
$image_create_handle = "imagecreatefrom".$types[$image_info[2]];
if ($image = $image_create_handle($src)) {
if (defined('CONVERT_IS_GD2') && CONVERT_IS_GD2 == 1) {
imagecopyresampled($thumb, $image, 0, 0, 0, 0, $width, $height,
ImageSX($image), ImageSY($image));
}
else {
imagecopyresized($thumb, $image, 0, 0, 0, 0, $width, $height, ImageSX
($image), ImageSY($image));
}
$image_handle = "image".$types[$image_info[2]];
$image_handle($thumb, $dest, $quality);
imagedestroy($image);
imagedestroy($thumb);
}
return (file_exists($dest)) ? 1 : 0;
}
Un saludo, Danny
Fernando Blat Peris
<ferblape@inf.upv.e Para: lista@phpes.com, php-cast@eListas.net
s> cc:
s>
Asunto: [PHP-ES] Problema al generar imagenes
automaticamente
02/10/2003 08:56
Por favor, responda
a lista
Hola,
estoy implementando una galería de imágines, así que necesito generar
dinámicamente miniaturas de las imágenes originales. Para ello uso el
siguiente código, que por lo que he visto por internet es correcto.
Miradlo por favor y decidme si veis algun error.
Muchas gracias.
------>8----Código_imagenes----->8-----------------------
$alto=200;
$ancho=300;
$fuente = ImageCreateFromJPEG("imagenes/PK001.jpg");
$imgAncho = imagesx ($fuente);
$imgAlto =imagesy($fuente);
$imagen = ImageCreate($ancho,$alto);
ImageCopyResized($imagen,$fuente,0,0,0,0,$ancho,$alto,$imgAncho,$imgAlto);
Header("Content-type: image/jpeg");
imagejpeg($imagen);
//Liberamos memoria
imagedestroy($imagen);
---------------------------------------------------------------------
Archivo On-line: http://www.phpes.com/
via news: news://news.phpes.com/
Manual PHP en español: http://www.php.net/manual/es/
Para dar de baja la suscripción, mande un mensaje a:
lista-unsubscribe@phpes.com