Ver Mensaje Individual
  #3 (permalink)  
Antiguo 07/10/2004, 08:37
Avatar de JuanKa
JuanKa
 
Fecha de Ingreso: septiembre-2004
Mensajes: 468
Antigüedad: 19 años, 6 meses
Puntos: 1
Hola Clustes una consulta...

Como verifico si me libreria gd esta activa como para ser estos thumbnails...
puesto q ue he puesto este codigo y nada..

<?php
function thumbnail($file,$dir,$ancho=100,$alto=100,$gif_sup port=false)
{
if(!file_exists($file)){
return false;
}
if(!is_dir($dir)){
return false;
}
$final = (int) strlen($file) - 4;
$nombre = strtolower(substr($file,0,$final));
$ext = strtolower(substr($file,-4,4));
$nombre = $nombre.$ext;
$mini = $dir."/mini_".$nombre;
if($ext==".jpg" || $ext==".jpeg"){
$origen = imageCreateFromJPEG($file);
$imgAncho= imageSx($origen);
$imgAlto = imageSy($origen);
$imagen = imageCreate($ancho,$alto);
ImageCopyResized($imagen,$origen,0,0,0,0,$ancho,$a lto,$imgAncho,$imgAlto);
imageJPEG($imagen,$mini);
}else if($ext==".png"){
$origen = imageCreateFromPNG($file);
$imgAncho= imageSx($origen);
$imgAlto = imageSy($origen);
$imagen = imageCreate($ancho,$alto);
ImageCopyResized($imagen,$origen,0,0,0,0,$ancho,$a lto,$imgAncho,$imgAlto);
imagePNG($imagen,$mini);
}else if(($gif_support==true) && ($ext==".gif")){
$origen = imageCreateFromGIF($file);
$imgAncho= imageSx($origen);
$imgAlto = imageSy($origen);
$imagen = imageCreate($ancho,$alto);
ImageCopyResized($imagen,$origen,0,0,0,0,$ancho,$a lto,$imgAncho,$imgAlto);
imageGIF($imagen,$mini);
}else{
return false;
}
return true;
}


if(!thumbnail("../Archivos/larga.jpg","../Thumbnails",80,80))
{ echo "error en creacion de thumbnails"; }
else
{ echo "Creacion exitosa"; }
?>



Gracias...