Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Transparant gifs problem

Status
Not open for further replies.

petersJazz

Programmer
Jan 28, 2002
222
EU
hi,

refering to thread434-1418977

I still have this small problem on the site where it is a admin page where you can download backgrounds. I split the gif file into nine pieces but then the transparent marker goes away. My next idee is to use black (#000000) as a marker for transparant but this doesnt work for me.

function uploadbg($tt){
$bgname=$_REQUEST['bgname'];
$uploaddir='../bg/';
$f=$uploaddir.'bg'.$bgname;
$filename=$_FILES['userfile']['name'];
$filenamex=$_FILES['userfile']['tmp_name'];
$uploadfile=$uploaddir.$filename;
$filetype=$_FILES['userfile']['type'];
$filesize=$_FILES['userfile']['size'];
if ($_FILES['userfile']['error']==2) {
...
}elseif ($filetype == 'image/gif') {
$im0=imagecreatefromgif($filenamex);
imagealphablending($im0, false);
imagesavealpha($im0, true);
$size=getimagesize($filenamex);
$w=$size[0]-60;
$h=$size[1]-60;
if ($w<10 || $h<10) {
...
}
$trno = imagecolortransparent($im0);
if ($trno >= 0) {
$rgb = imagecolorsforindex($im0, $transp);
$transp = ($rgb['red'] << 16) | ($rgb['green'] << 8) | $rgb['blue'];
imagecolortransparent($im0, imagecolorallocate($im0, 0, 0, 0));
}
$this->doimg($im0,0,0,30,30,$f.'1.gif',$transp,$trno);
$this->doimg($im0,30,0,$w,30,$f.'2.gif',$transp,$trno);
$this->doimg($im0,$w+30,0,30,30,$f.'3.gif',$transp,$trno);
$this->doimg($im0,0,30,30,$h,$f.'4.gif',$transp,$trno);
$this->doimg($im0,30,30,$w,$h,$f.'5.gif',$transp,$trno);
$this->doimg($im0,$w+30,30,30,$h,$f.'6.gif',$transp,$trno);
$this->doimg($im0,0,$h+30,30,30,$f.'7.gif',$transp,$trno);
$this->doimg($im0,30,$h+30,$w,30,$f.'8.gif',$transp,$trno);
$this->doimg($im0,$w+30,$h+30,30,30,$f.'9.gif',$transp,$trno);
logg('page',$tt[6].$bgname);
return;
} else {
...
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top