function Imagem($img,$logo){ $this -> Img = getimagesize($img); $type = $this -> Img[2]; if( $type==1 ){ $this -> Copia = imagecreatefromgif( $img ); }elseif( $type==3 ){ $this -> Copia = imagecreatefrompng( $img ); }elseif( $type==2 ){ $this -> Copia = imagecreatefromjpeg( $img ); } $this -> X = imagesx($this -> Copia); $this -> Y = imagesy($this -> Copia); $this -> Logo = imagecreatefromjpeg("imagens/$logo"); imagecopymerge($this->Copia , $this -> Logo , $this -> X - (imagesx($this -> Logo) + 5) , $this -> Y - ( imagesy($this -> Logo) + 5 ) , 0 , 0 , imagesx($this -> Logo) , imagesy($this -> Logo) , 100); header ("Content-type: image/jpeg"); imagepng($this -> Copia); @imagedestroy( $this->Copia ); @imagedestroy( $this->Logo ); } function Thumb($img,$dim){ $this -> Img = getimagesize($img); $type = $this -> Img[2]; if( $type==1 ){ $this -> Copia = imagecreatefromgif( $img ); }elseif( $type==3 ){ $this -> Copia = imagecreatefrompng( $img ); }elseif( $type==2 ){ $this -> Copia = imagecreatefromjpeg( $img ); } $this -> X = imagesx($this -> Copia); $this -> Y = imagesy($this -> Copia); if($this -> X > $this -> Y){ $this -> T_X = $dim; $this -> T_Y = floor( ($this -> Y * $dim) / $this -> X ); }elseif( $this -> Y > $this -> X ){ $this -> T_Y = $dim; $this -> T_X = floor( ($this -> X * $dim) / $this -> Y ); }else{ $this -> T_X = $dim; $this -> T_Y = $dim; } $this -> Thumb = imagecreatetruecolor( $this -> T_X , $this -> T_Y ); imagecopyresampled( $this -> Thumb , $this -> Copia, 0,0,0,0, $this -> T_X ,$this -> T_Y , $this -> X, $this -> Y ); header ("Content-type: image/jpeg"); imagejpeg($this -> Thumb); @imagedestroy( $this->Thumb ); @imagedestroy( $this->Copia ); }
ele ta gerando em PNG, e a imagem ta muito grande.. tpw.. ele pega a logo q tem 6kb mais a foto q tem 20kb e a foto fica com 200kb em png... queria gerar em jpg.. pra ver se diminui um pouco...
Edição feita por: hefestos, 19/12/2005, 13:17.