GD - TF Image

Status
Not open for further replies.
That's just thrown it all off for me now aswell.

I'm getting:

Parse error: syntax error, unexpected T_STRING in /public_html/tfgenerate.php on line 11

I think we may need to re-code this from scratch :p

CrazeD tech forums.png is the image that the GD is laying text over. It can be viewed by this link

http://193.111.226.179/tf.png

Cheers Guys,

~ Tkey
 
Well I screwed with it for a bit and couldn't make the image more clear. I'm not real experienced with GD. I'll continue to search around for an answer though.
 
Could you repost the whole code I need. I'm not sure what you're trying to get in :p

Thanks alot,

~ Tkey
 
PHP:
imagestring($im, 3, 0, 35, $text, $color);

When you where gonna replace a line with that, i forgot the ' ; ' at the end. 8)
 
Thanks, i'v updated the code and it's still looking grainy. Any suggestions, do I prehaps need to change the filetype?

Cheers,

~ Tkey
 
It is blurry if all you do is imagecreatefrompng().

Shouldn't be the filetype, although maybe. Try a gif. Try making the background not transparent.
 
MUAHAHHAHA I FOUND IT.
After the imagecreatefrompng line, add these two:

PHP:
imageAlphaBlending($im, true);
imageSaveAlpha($im, true);

I tried it for myself and it works nicely.
 
That's working beautifullly now thanks ;)

Here's the code I have now

Code:
<?php
header('Content-type: image/png');
$text = $_GET['text'];
$im = imagecreatefrompng ("tech forums.png");
imagestring($im, 3, 0, 35, $text, $color); 
$color = imagecolorallocate($im, 0, 0, 0);
imageAlphaBlending($im, true);
imageSaveAlpha($im, true); 
$font = 'font.ttf';
$fontsize = 24;
$size = imagettfbbox($fontsize, 0, $font, $text); //calculate the pixel of the string
$dx = (imagesx($im)) - (abs($size[2]-$size[0])) - 20; //calculate the location to start the text
imagettftext($im, $fontsize, 0, $dx, 35, $color, $font, $text);
imagepng($im);
imagedestroy($im);
?>

For some reson text is appearing twice :p , not sure what I have in the code but that needs to go :)

Also I need to set the colours properly and include "Hey," at the front every time...

Thanks for you continued help ;)

~ Tkey

(http://193.111.226.179/tfgenerate.php?text=TestUser123)
 
Status
Not open for further replies.
Back
Top Bottom