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);

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

<?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);    
?>

Link to comment
Share on other sites

<?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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.