Advertisement:

Author Topic: signature info stats [no more updates and support]  (Read 171559 times)

Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,622
    • StoryBB/StoryBB on GitHub
Re: signature info stats [no more updates and support]
« Reply #200 on: January 28, 2014, 08:24:24 PM »
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.
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline MoreBloodWine

  • SMF Hero
  • ******
  • Posts: 2,723
  • Gender: Male
  • ...
    • Uncharted 2: Among Thieves Stat Sig Generator
Re: signature info stats [no more updates and support]
« Reply #201 on: January 28, 2014, 10:48:45 PM »
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.

Code: [Select]
ImageString($im, 3, 100, 37, "BTC-Guild User: $user_name", $lightblue);
ImageLine($im, 100, 50, 302, 50, $lightblue);
« Last Edit: January 28, 2014, 11:43:29 PM by MoreBloodWine »
Want a sig like mine for your BTCGuild stats ? Then check this out: Spend-ur-Bits


Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,622
    • StoryBB/StoryBB on GitHub
Re: signature info stats [no more updates and support]
« Reply #202 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...
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline MoreBloodWine

  • SMF Hero
  • ******
  • Posts: 2,723
  • Gender: Male
  • ...
    • Uncharted 2: Among Thieves Stat Sig Generator
Re: signature info stats [no more updates and support]
« Reply #203 on: January 29, 2014, 12:00:19 AM »
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.

Code: [Select]
$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


Offline Arantor

  • Resident Overthinker
  • SMF Friend
  • SMF Legend
  • *
  • Posts: 71,622
    • StoryBB/StoryBB on GitHub
Re: signature info stats [no more updates and support]
« Reply #204 on: January 29, 2014, 12:11:07 AM »
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...
Don’t try to tell me that some power can corrupt a person. You haven’t had enough to know what it’s like.

No good deed goes unpunished / No act of charity goes unresented.

Offline MoreBloodWine

  • SMF Hero
  • ******
  • Posts: 2,723
  • Gender: Male
  • ...
    • Uncharted 2: Among Thieves Stat Sig Generator
Re: signature info stats [no more updates and support]
« Reply #205 on: January 29, 2014, 12:29:27 AM »
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