Ver Mensaje Individual
  #9 (permalink)  
Antiguo 25/11/2008, 14:56
nfo
 
Fecha de Ingreso: octubre-2008
Ubicación: EsPaCiO TiEmPo
Mensajes: 408
Antigüedad: 15 años, 6 meses
Puntos: 5
Respuesta: [APORTE] EasyThumbnail

Pato12 respuesta a tu mensaje.

Pues n ose compañero cual puede ser el fallo, yo me tome la libertad de cambiar un poco tu clase y la puse asi. pero el fallo persiste y es solo con el bmp con png o gif todo perfecto.

Código PHP:
<?php
/*******************************************************************************
** *****************************************************************************
**                               EasyThumbnail                                **
** *****************************************************************************
** Nombre      : EasyThumbnail                                                **
**                                                                            **
** Creador     : Pato12 <de Forosdelweb.com>                                  **
**                                                                            **
** Description : Sirve para redimensionar una imagen, para crear Thumbnail    **
**               y para escribir una imagen fácilmente.                       **
**                                                                            **
** Contacto    : MP de forosdelweb.com al usuario Pato12                      **
**                                                                            **
** Version     : 1.5 (BETA)                                                   **
**                                                                            **
** Web del                                                                    **
** creador     : www.halfmusic.com.ar                                         **
********************************************************************************
********************************************************************************
*   Este scriopt PHP es libre de usar siempre cuando no borren estas lineas
*   y respeten la licencia GPL :
*   http://opensource.org/licenses/gpl-license.php GNU Public License
**********************************************************************************/
    
class EasyThumbnail{
    private 
$imagen;
    private 
$image;
    private 
$height;
    private 
$width;
    private 
$calidad;
    private 
$srcw;
    private 
$srch;
    private 
$ext;
    private 
$txt;
    public function 
EasyThumbnail($str){
    if(!
file_exists($str))
    die(
'¡El archivo '.$str.' no existe!');
    
$this->detecExt($str);
    switch(
$this->ext){
    case 
"JPG":
    
$this->ext="JPEG";
    
$this->imagen ImageCreateFromJPEG ($str);
    break;
    case 
"JPEG":
    
$this->ext="JPEG";
    
$this->imagen ImageCreateFromJPEG ($str);
    break;
    case 
"PNG":
    
$this->ext="PNG";
    
$this->imagen ImageCreateFromPNG ($str);
    break;
    case 
"GIF":
    
$this->ext="GIF";
    
$this->imagenImageCreateFromGIF ($str);
    break;
    case 
"BMP":
    
$this->ext="BMP";
    
$this->imagenImageCreateFromWBMP ($str);
    break;
    default:
    die(
"Error - extencion no valida");
    break;
    }
      
$this->srcw=imagesx($this->imagen);
      
$this->srch=imagesy($this->imagen);
    
$this->calidad=75;
    
$this->height 50;
    
$this->width 50;
    }
    public function 
detecExt($str){
    
$this->ext=ereg_replace(".*\.(.*)$","\\1",$str);
    
$this->ext=strtoupper($this->ext);
    }
    public function 
height($str=50){
    if(
$str<50)
    
$str=floor($this->srch*$this->width/$this->srcw);
        
$this->height $str;
    }
    public function 
width($str=50){
    if(
$str<50)
    
$str=floor($this->srcw*$this->height/$this->srch);
        
$this->width $str;
    }
    public function 
calidad($str=75){
        
$this->calidad=$str;
    }
    public function 
automatico($str=50){
    if (
$this->srcw<$this->srch) {
    
$this->height=$str;
    
$this->width=floor($this->srcw*$this->height/$this->srch);
    }else{
    
$this->width=$str;
    
$this->height=floor($this->srch*$this->width/$this->srcw);
    }
      if (
$this->width>$this->srcw && $this->height>$this->srch) {
    
$this->width=$this->srcw;
    
$this->height=$this->srch;
    }
    }
    public function 
text($t,$x=0,$y=0,$u="#000000",$f=NULL,$f2=20,$a=0){
    list(
$c1,$c2,$c3)=sscanf($u'#%2x%2x%2x');
    
$c=imagecolorallocate($this->imagen,$c1,$c2,$c3);
    if(
$f==NULL)
    @
imagestring($this->imagen,$f2,$x,$y,$t,$c);
    else
    @
imagettftext($this->imagen$f2$a$x$y$c$f$t);
    }
    public function 
crear($dir){
    if(
$dir=="")
    return 
false;
    if(
$this->width=="" && $this->height=="")
    die(
'¡Selecione tamaño!');
    
$this->image ImageCreateTrueColor($this->width,$this->height);
    @
imagecopyresampled ($this->image$this->imagen0000,$this->width ,$this->height ,$this->srcw $this->srch);
    switch(
$this->ext){
    case 
"JPG":
    
imageJPEG($this->image,$dir,$this->calidad);
    break;
    case 
"JPEG":
    
imageJPEG($this->image,$dir,$this->calidad);
    break;
    case 
"PNG":
    
imagePNG($this->image,$dir);
    break;
    case 
"GIF":
    
imageGIF($this->image,$dir);
    break;
    case 
"BMP":
    
imageWBMP($this->image,$dir);
    break;
    default:
    die(
"Error - extencion no valida");
    break;
    }
    @
imagedestroy($this->image);
    }
    }
?>
Espero que no te haya importando.