Michdd Posted November 6, 2008 Share Posted November 6, 2008 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 https://forums.phpfreaks.com/topic/131587-solved-problem-with-imagecolortransparent/ Share on other sites More sharing options...
Michdd Posted November 6, 2008 Author Share Posted November 6, 2008 No one has any ideas? I could post the script in which it worked, but now I have to go to bed, I really need to this work, so please, help me. Lol. Link to comment https://forums.phpfreaks.com/topic/131587-solved-problem-with-imagecolortransparent/#findComment-683443 Share on other sites More sharing options...
Michdd Posted November 6, 2008 Author Share Posted November 6, 2008 Can anyone at least tell me if it looks valid? Link to comment https://forums.phpfreaks.com/topic/131587-solved-problem-with-imagecolortransparent/#findComment-683943 Share on other sites More sharing options...
DeanWhitehouse Posted November 6, 2008 Share Posted November 6, 2008 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. Link to comment https://forums.phpfreaks.com/topic/131587-solved-problem-with-imagecolortransparent/#findComment-683949 Share on other sites More sharing options...
Michdd Posted November 6, 2008 Author Share Posted November 6, 2008 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 https://forums.phpfreaks.com/topic/131587-solved-problem-with-imagecolortransparent/#findComment-683954 Share on other sites More sharing options...
Barand Posted November 6, 2008 Share Posted November 6, 2008 Attach your png image so we can at least have a chance of seeing what's wrong Link to comment https://forums.phpfreaks.com/topic/131587-solved-problem-with-imagecolortransparent/#findComment-683966 Share on other sites More sharing options...
Michdd Posted November 6, 2008 Author Share Posted November 6, 2008 Attach your png image so we can at least have a chance of seeing what's wrong The image has a white background, and it just stays white, and doesn't go transparent. Attaching image: [attachment deleted by admin] Link to comment https://forums.phpfreaks.com/topic/131587-solved-problem-with-imagecolortransparent/#findComment-683970 Share on other sites More sharing options...
Barand Posted November 6, 2008 Share Posted November 6, 2008 <?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 https://forums.phpfreaks.com/topic/131587-solved-problem-with-imagecolortransparent/#findComment-683983 Share on other sites More sharing options...
Michdd Posted November 6, 2008 Author Share Posted November 6, 2008 <?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 https://forums.phpfreaks.com/topic/131587-solved-problem-with-imagecolortransparent/#findComment-684001 Share on other sites More sharing options...
Barand Posted November 6, 2008 Share Posted November 6, 2008 I meant to add some explanation. $x in my code is the pallette index of the white in the image. Your bg was the index of your newly added white color. Link to comment https://forums.phpfreaks.com/topic/131587-solved-problem-with-imagecolortransparent/#findComment-684009 Share on other sites More sharing options...
DeanWhitehouse Posted November 6, 2008 Share Posted November 6, 2008 Solved?,click the bottom left link. Link to comment https://forums.phpfreaks.com/topic/131587-solved-problem-with-imagecolortransparent/#findComment-684012 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.