| Coding Forum Problems with your code? Let's hear about it. |
04-15-2006, 04:12 PM
|
#1 (permalink)
|
|
Contributing Member
Join Date: 12-14-05
Posts: 109
Latest Blog: None
|
making graphics with php - problem with text
i'm creating graphics on the fly using php, and when i use a transparent background and then print text to the graphic, it doesn't look right when viewed on a black background. the text is anti-aliased over a white background. hard to explain so i'll show ya:
looks fine there, but now look:
http://bashfreebieguide.com/temp/badgif.html
any way to fix this?
|
|
|
04-15-2006, 04:17 PM
|
#2 (permalink)
|
|
Possible Terrorist
Join Date: 10-13-03
Location: Tuscaloosa, AL or Atlanta
Posts: 4,904
|
Are you using code like this?
PHP Code:
$image = imagecreatetruecolor(192, 36); $trans_color = imagecolorallocate($image, 255, 0, 0); $color = imagecolorallocate($image, 255, 255, 255); imagecolortransparent($image, $trans_color); imagettftext($image, 10, 0, 10, 23, $color, "impact.ttf", " MENU ITEM"); imagegif($image, "output.gif"); imagedestroy($image);
__________________
Kyle Varga
"m3lt/theSpear"
student, web designer/coder, future IT consultant
Experience: PHP/MySQL, Java, C++, MS-SQL
|
|
|
04-15-2006, 04:22 PM
|
#3 (permalink)
|
|
Contributing Member
Join Date: 12-14-05
Posts: 109
Latest Blog: None
|
yeah, pretty much:
Code:
$white = imagecolorallocate($mygraphic, 255, 255, 255);
$black = imagecolorallocate($mygraphic, 0, 0, 0);
$bgcolor = imagecolortransparent($mygraphic, $white);
imagefilledrectangle($mygraphic, 0, 0, $width, $$height, $bgcolor);
imagettftext($mygraphic, $textsize, 0, $curX, $curY, $curcolor, $font, $txt);
imagegif($mygraphic, $username . ".gif");
imagedestroy($mygraphic);
|
|
|
04-15-2006, 04:26 PM
|
#4 (permalink)
|
|
Possible Terrorist
Join Date: 10-13-03
Location: Tuscaloosa, AL or Atlanta
Posts: 4,904
|
Not sure, I know its transparency is shaky at best,
should try routing through ImageMagick if you can
__________________
Kyle Varga
"m3lt/theSpear"
student, web designer/coder, future IT consultant
Experience: PHP/MySQL, Java, C++, MS-SQL
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 11:06 AM.
© Copyright 2008 V7 Inc
|