• This forum has been archived. New threads and replies may not be made. All add-ons/resources that are active should be migrated to the Resource Manager. See this thread for more information.

Signature Badge Script

  • Thread starter Thread starter Floris
  • Start date Start date
Excellent work Alex and Eric, I am glad a silly prank in my signature for a trophy listing has resulted in .xml by Kier and code by the community and dynamic signatures for everybody :)
 
Excellent work Alex and Eric, I am glad a silly prank in my signature for a trophy listing has resulted in .xml by Kier and code by the community and dynamic signatures for everybody :)

I did say I liked that "prank" though, it looked pretty sweet
 
Are you using image tiles or are you drawing everything with GD? :) This is what I'm going to create with GD in a bit, but I have to do something else right now so it might not be done for a while. :)

6ugY9.png
wow, that looks fantastic - one little thing though - shoudn't the XenForo logo bit be XF ? I think there was some thread somewhere where someone clarified this <- don't you just love specifics (need more coffee)
 
I'm now actually showing an error as an image instead of empty values. don't think there's any way of me getting around privacy settings though


I actually have a working mockup for that design, but I'm not going to release it until Erik lets me, for obvious reasons

Almost done, hang in there. :) I've got some extra surprises up my sleeve with this release, too. :) I would love to compare code when I'm done. :)
 
Make the F smaller, so XF is just capitalized lowercase .. if that make sense. :>

THANK YOU ALL
 
Ok, this is finally ready, it's 5:40 AM here and I am ready to go to bed. :D

So, here's the scoop: This thing has multiple options so you can customize your signature. :D

First, you have 7 colors to choose from:
Blue (default):
blue.png

Red:
red.png

Green:
green.png

Yellow: (this still needs work, I will fix it tomorrow)
yellow.png

Orange:
orange.png

Purple:
purple.png

Gray:
gray.png


In addition, you can choose whether you want to show the little 'xF' wordmark, the username, both, or neither:

blue.png


noxf.png


noname.png


nonothing.png


And finally, you can choose which of the three elements you want to display by specifying them in a comma-separated list (at least one is required). Some examples:

postslikes.png
<-- yes, I can see how it's getting cut off, fix will have to wait for tomorrow (5:30 AM now! :eek:)

trophies.png


And YES, you can combine all of the options to do something totally awesome and unique like this:

all.png


These are all accessible via query strings like:
signature.php?userid=103&color=purple&elements=posts,likes&showName=false

However only userid is required, everything else will just default to this:

floris.png


Here's the documentation on the query strings/options (also included in the PHP file):
Code:
// ### Available options: ###
// type                            name        default        description
// ----------------------------------------------------------------------------------------------------
// int                            userID                    The ID number of the user
//
// {red, blue, yellow,             color        blue        The color of the background element and text
//  green, purple, orange,
//  gray}
//
// {posts, trophies, likes}        elements    all 3        Pick elements to show in the badge. You may mix and match, at least one (1) is required
//
// bool                            showName    true        If true, will show the Username and a dotted line seperator to the right
//
// bool                            showXF        true        If true, will show the small "xF" logo piece to the left of the username

For those that know their way around code, I've also implemented some basic server-side caching that uses a single XML file and a single cached image file per userid. I don't know if this is even efficient or if there's a better way to do it, so feedback is appreciated. Here's the code snippet:

PHP:
if(SERVERSIDE_CACHING) {
    if(file_exists(IMGDIR . 'xml/' . $userid . '.xml')) {
        // an image has been generated before for this user
        $userxml = simplexml_load_file(IMGDIR . 'xml/' . $userid . '.xml');
        if($membername == (string)$userxml->username and $posts == (string)$userxml->message_count and $likes == (string)$userxml->total_likes and $trophies == (string)$userxml->trophy_points and $_SERVER['REQUEST_URI'] == (string)$userxml->query_string) {
            // nothing has changed, we can use the old image
            if(file_exists(IMGDIR . 'generated_images/' . $userid . '.png')) {
                // let's make sure the image we are going to include actually exists
                header('Content-type: image/png');
                header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
                header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
                header('Cache-Control: no-store, no-cache, must-revalidate');
                header('Cache-Control: post-check=0, pre-check=0', false);
                header('Pragma: no-cache');
                // everything looks good, include image and exit. :)
                include(IMGDIR . 'generated_images/' . $userid . '.png');
                exit;
            } // image missing, need to regenerate
        } // data is different, need to regenerate
    } // no XML file, first image generated for user
} // server-side caching disabled
(No idea why there's a line break after the '-'s in the code - it's a bug in the code parsing I guess.)

The code in its entirety is 282 lines, so I'm not going to post it inline here. I've attached a .zip file with all the required images, fonts, and code, that you should be able to just upload and run.

I also plan to create a nice, user-friendly form where someone can select the options from a dropdown, etc., but right now the sun is coming up and I need to sleep. :p

Ceri May (or anyone else), if you want to take the code and upload it and get it running, go right ahead. Just be aware that there are probably going to be at least a few bug fixes tomorrow that you would have to 'patch in.'

Oh, and if you liked this, Click the LIKE button! :p :D

Thanks, guys. :)
 

Attachments

congrats, you have officially shat on my script :)

my attempt at copying your style looked like this:
xensig.php
 
congrats, you have officially shat on my script :)

my attempt at copying your style looked like this:
xensig.php

Not bad at all. It scales, so... Can I see the code? It took me a long time to get all the scaling code right, I want to see if you have a more efficient/easier way to do it. :)

And honestly, I kind of like how yours renders. What platform is it running on? What weight? How are you writing it, layering it? Mine is anti-aliased but I kind of like how yours has that 'crisp' look. :)
 
xensig.php
:(
Ok, I wont be a douche and not explain my theory on why mine doesnt work.

I think my privacy settings are blocking it. :D

That is the problem I was having also... If you set your profile to only followers OR only members it doesn't work :(
 
looking at yours we seem to have done it in a similar way. need to start working on arabic characters on something crazy now :|

I do have the end of the text happily going into the cap though :D I'll leave you to think of a cleaner way to achieve that, mine is a bit dirty
 
looking at yours we seem to have done it in a similar way. need to start working on arabic characters on something crazy now :|

I do have the end of the text happily going into the cap though :D I'll leave you to think of a cleaner way to achieve that, mine is a bit dirty

I could have mine going into the cap too (I think). It's just that I have the right padding set high enough where it doesn't look that way. :)

EDIT: Nevermind, it doesn't go into the cap (just cuts it off). I think this is a problem with how I'm flattening the different layers... will fix tomorrow (it should be able to go into the cap in theory). :)
 
Make sure you guys cache your results, don't want to get hammered by everybody here :)

Eric & Disjunto: AWESOME work :)
 
Top Bottom