martian2k4 Posted December 14, 2006 Share Posted December 14, 2006 Hey all, I am using GD and it all works ok exept for the color of the text is a blue (Like the color of the image for the background) but it should be white.<?phpheader("Content-type: image/png");$string = "TESTING";$im = imagecreatefrompng("images/1.png");$white = imagecolorallocate($im, 255, 255, 255);$px = (imagesx($im) - 7 * strlen($string)) / 2;imagestring($im, 3, $px, 15, $string, $white);imagepng($im);imagedestroy($im);?>Is the code. Could some one tell me whats wrong? Thanks Link to comment https://forums.phpfreaks.com/topic/30661-small-gd-problem/ Share on other sites More sharing options...
zq29 Posted December 14, 2006 Share Posted December 14, 2006 Hmmm, I made a slight modification to it to run on my machine without your 1.png file and the text is infact white for me...Can you run the script, save the image and check what hex the colour is with a graphics package?Just for reference, the modifications made were:[code]<?phpheader("Content-type: image/png");$string = "TESTING";$im = imagecreate(800,600);$bg = imagecolorallocate($im, 0, 0, 0);$white = imagecolorallocate($im, 255, 255, 255);$px = (imagesx($im) - 7 * strlen($string)) / 2;imagestring($im, 3, $px, 15, $string, $white);imagepng($im);imagedestroy($im);?>[/code]Is the text white when you run that? Link to comment https://forums.phpfreaks.com/topic/30661-small-gd-problem/#findComment-141286 Share on other sites More sharing options...
martian2k4 Posted December 14, 2006 Author Share Posted December 14, 2006 I tried the code you gave me and the text was white. But [url=http://www.styleyourspace.com/gen/gen.php]http://www.styleyourspace.com/gen/gen.php[/url] thats the script which isn't working for me Link to comment https://forums.phpfreaks.com/topic/30661-small-gd-problem/#findComment-141341 Share on other sites More sharing options...
zq29 Posted December 14, 2006 Share Posted December 14, 2006 Hmmm, maybe there are not enough colours in your palette to support white - Maybe they're all being used up by the colours in your gradient? Link to comment https://forums.phpfreaks.com/topic/30661-small-gd-problem/#findComment-141345 Share on other sites More sharing options...
martian2k4 Posted December 14, 2006 Author Share Posted December 14, 2006 Ahh sorted :):):)thanks a lot :D Link to comment https://forums.phpfreaks.com/topic/30661-small-gd-problem/#findComment-141368 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.