Ver Mensaje Individual
  #5 (permalink)  
Antiguo 12/02/2009, 19:15
j-andres86
 
Fecha de Ingreso: febrero-2009
Ubicación: Mocoa - Colombia
Mensajes: 15
Antigüedad: 16 años, 1 mes
Puntos: 1
Respuesta: Problema con la libreria PHPImagen.lib.php

Hola GatorV,

no me sale ningun error solo no me muestra la imagen redimensionada.

te pongo el codigo de la libreria de las funciones resize y doprint de la libreria PHPImagen.lib.php

Código PHP:

public function resize($maxancho=null,$maxalto=null,$cut=false) {
        if(
$this->stop()) 
            return;
        if(
$cut != false$this->cut true;
        
$this->mw = (!is_numeric($maxancho) or $maxancho 1) ? $this->intval($maxancho);
        
$this->mh = (!is_numeric($maxalto) or $maxalto 1) ? $this->intval($maxalto);
        
$diff_w $this->w/$this->mw;
        
$diff_h $this->h/$this->mh;
        if(
$this->cut == true) {
            
$this->rh $this->mh;
            
$this->rw $this->mw;
            if(
$diff_w $diff_h) {
                
$prop $this->mh/$this->h;
                
$this->mw round($this->w*$prop);
                
$dist_x = ($this->rw-$this->mw)/2;
            } else {
                
$prop $this->mw/$this->w;
                
$this->mh round($this->h*$prop);
                
$dist_y = ($this->rh-$this->mh)/2;
            }
        } else {
            if(
$diff_w $diff_h) {
                
$prop $this->mw/$this->w;
                
$this->mh round($this->h*$prop);
            } else {
                
$prop $this->mh/$this->h;
                
$this->mw round($this->w*$prop);
            }
            
$this->rw $this->mw;
            
$this->rh $this->mh;
        }
        
$output imagecreatetruecolor($this->rw$this->rh);
        if(
$this->type == "gif" or $this->type == "png") {
            
$trn_i imagecolortransparent($this->source);
            if (
$trn_i >= 0) {
                
$trn_c imagecolorsforindex($this->source$trn_i);
                
$trn_i imagecolorallocate($output$trn_c['red'], $trn_c['green'], $trn_c['blue']);
                
imagefill($output00$trn_i);
                
imagecolortransparent($output$trn_i);
            } elseif(
$this->type == "png") {
                
imagealphablending($outputfalse);
                
$color imagecolorallocatealpha($output000127);
                
imagefill($output00$color);
                
imagesavealpha($outputtrue);
            } 
        }
        
$r imagecopyresampled($output$this->source$dist_x$dist_y00$this->mw$this->mh$this->w$this->h);
        
$this->source $output;
        return 
$r;
    } 
Código PHP:

public function doPrint($quality=null) {
        
$quality = (is_numeric($quality) and $quality <= 100 and $quality >= 1) ? intval($quality) : 75;
        
Header("Content-type: image/".$this->type);
        
$f2 $this->f2;
        switch(
$this->type) {
            case 
"gif":
                
imagegif($this->source);
                break;
            case 
"jpeg":
                
imagejpeg($this->source,null,$quality);
                break;
            case 
"png":
                
$quality 10 - (round($quality 10));
                
imagepng($this->source,null,$quality,PNG_ALL_FILTERS);
                break;
        } 
        exit;
    }