Jump to content

[SOLVED] Problem with imagecolortransparent()


Michdd

Recommended Posts

I'm pretty sure I used that exact thing before, and it worked fine. It's supposed to make white show transparent, but it's not working, anyone see a reason why?

 

$im = imagecreatefrompng('gomlo.png');
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor2 = imagecolorallocate($im, 0, 0, 0);

imagestring($im, 5, 43, 10, $name, $textcolor2);
imagestring($im, 5, 33, 100, 'Level '.$level, $textcolor2);


header('Content-type: image/png');

imagecolortransparent($im, $bg);

imagepng($im);
imagedestroy($im);

You are supposed to wait 12 hours before bumping a thread. Please wait, we are not paid and are doing this out of our spare time, in which we could being selling our services.

I waited more than 13 hours with my second bump, sorry, this is just really annoying me, I don't see any problems with it, yet it's not making White transparent.

<?php    
$im = imagecreatefrompng('gomlo.png');
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor2 = imagecolorallocate($im, 0, 0, 0);

imagestring($im, 5, 43, 10, $name, $textcolor2);
imagestring($im, 5, 33, 100, 'Level '.$level, $textcolor2);


header('Content-type: image/png');

$x = imagecolorat($im, 0,0);
imagecolortransparent($im, $x);

imagepng($im);
imagedestroy($im);    
?>

<?php    
$im = imagecreatefrompng('gomlo.png');
$bg = imagecolorallocate($im, 255, 255, 255);
$textcolor2 = imagecolorallocate($im, 0, 0, 0);

imagestring($im, 5, 43, 10, $name, $textcolor2);
imagestring($im, 5, 33, 100, 'Level '.$level, $textcolor2);


header('Content-type: image/png');

$x = imagecolorat($im, 0,0);
imagecolortransparent($im, $x);

imagepng($im);
imagedestroy($im);    
?>

Thanks a lot! This was really bothering me. I really appreciate it.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.