Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/08/2006, 14:20
LivePHP
 
Fecha de Ingreso: agosto-2006
Mensajes: 1
Antigüedad: 17 años, 7 meses
Puntos: 0
Exclamación transparencias en gif

Buenas, tengo el siguiente codigo para redimensionar imagenes, pero siempre las gif con transparencias las regresa con fondo negro, como puedo hacer que sea de color blanco el fondo?

digamos que accedo asi:
script.php?src=foto1.gif
Código PHP:
<?php
if (isset($_GET['src'])) {
    
$anchura 100;
    
$hmax 100;
    
$nombre $_GET['src'];
 
$datos getimagesize($nombre);

if(
$datos[2]==1){$img = @imagecreatefromgif($nombre);}
if(
$datos[2]==2){$img = @imagecreatefromjpeg($nombre);}
if(
$datos[2]==3){$img = @imagecreatefrompng($nombre);}

    if(
$_GET['red'] == "oui"){
$ratio = ($datos[0] / $anchura);
$altura = ($datos[1] / $ratio);

if(
$altura>$hmax){$anchura2=$hmax*$anchura/$altura;$altura=$hmax;$anchura=$anchura2;}
$thumb imagecreatetruecolor($anchura,$altura);
imagecopyresampled($thumb$img0000$anchura$altura$datos[0], $datos[1]);

    }else{

$thumb imagecreatetruecolor($datos[0],$datos[1]);
imagecopy($thumb$img0000$datos[0], $datos[1]);

    }



if(
$_GET['cel'] == "oui"){
header("Content-type: image/jpeg");imagejpeg($thumb);
        }else{

if(
$datos[2]==1){header("Content-type: image/gif"); imagegif($thumb);}
if(
$datos[2]==2){header("Content-type: image/jpeg");imagejpeg($thumb);}
if(
$datos[2]==3){header("Content-type: image/png");imagepng($thumb); }


}
imagedestroy($thumb);

}

?>