signature info stats [no more updates and support]

Started by sebastian, August 20, 2005, 10:42:12 PM

Previous topic - Next topic

Arantor

Um, what exactly is the problem? You already have your image ($im), you already know the top left corner of the text you're working on (since you're supplying it with the imagestring calls), you already have your colour.

You're just feeding it the x,y co-ordinates of where the line is supposed to start and where it's supposed to end. You already have the x starting co-ordinate (same as the text's x co-ordinate), you'll need to add a few pixels to y to get its y position (since you already have the TOP of the text, you need to add some for the height, plus probably 2 pixels to give it space, whatever looks right)

Then for the end of the line, y will be the same (since it's horizontal) and x will be the start plus the number of letters * the width of the font in use. imagefontwidth(3) and imagefontheight(3) will tell you the size of all the letters in font 3 which is what you're using. You should be able to figure this out if you just take a minute to think about it.

MoreBloodWine

#201
Just need to find a more appropriate background image but check it out ;-)
Image found !



All varibles updated from a file thats auto written by a cron job from an API !

Edit: Do you know if there's a way to auto length the line to cover the length of the text line if that makes sense ?

Basically if I render this for other users thee underline will eeither be too long or not long enough based on the length of their displayed name compared to mine.

ImageString($im, 3, 100, 37, "BTC-Guild User: $user_name", $lightblue);
ImageLine($im, 100, 50, 302, 50, $lightblue);
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Arantor

This is why I sort of hinted at "Then for the end of the line, y will be the same (since it's horizontal) and x will be the start plus the number of letters * the width of the font in use"

As in you know the line you're writing, you know the number of letters in it (strlen is your friend), you know the size of the font (imagefontwidth is your friend)... I'm pretty sure by now that you know how to multiply two numbers together and add another...

MoreBloodWine

Quote from: Sir Cumber-Patcher on January 28, 2014, 11:06:02 PM
This is why I sort of hinted at "Then for the end of the line, y will be the same (since it's horizontal) and x will be the start plus the number of letters * the width of the font in use"

As in you know the line you're writing, you know the number of letters in it (strlen is your friend), you know the size of the font (imagefontwidth is your friend)... I'm pretty sure by now that you know how to multiply two numbers together and add another...
Ya 1 x 2 + 4 = 6

Just not sure on the new code.

Edit: Got some of it worked out...

Just need to work on the imagefontwidth thing now... hope I can pick it up the way I have the rest lol.

$str = "BTC-Guild User: " . $user_name;
$length = strlen($str);

ImageString($im, 3, 100, 37, "$str - $length", $lightblue);
ImageLine($im, 100, 50, 302, 50, $lightblue);


Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Arantor

Well, if the line starts at 100... it's going to end at 100 + ($length * imagefontwidth(3)), right?

A string take away a number doesn't mean anything...

MoreBloodWine

Thx... was hopin to get it on my own but thx ;-)
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Advertisement: