Linux Mint Generated Button

Linux Mint Button

After a little discussion and some information about how wordpress.com functions from mesanna I’ve quite quickly made the first demo version of a generated button. And here it is.

So far it’s really just proof of concept, and its code is a little limited but could very easily and quickly be improved, depending on what information you actually wanted to share. The reason I’ve put the date in for now is because it’s the simplest way to show the principle involved here. The date comes from the php function of the same name in this case I used:

date("D jS M - G:i");

What I’m trying to show here is that information available on the server side: databases, xml feeds, _POST and _GET requests, anything; can quite easily be transposed into a graphic without the need for java or anything that is blocked on wordpress.com. The sky is the limit!

The image src (if you look at the code) is actually:

<img src="http://bendavis.me/mintpromo/button.php" alt="Linux Mint Button" width="181" height="60" รขยโ€ž>

If you visit ../button.php you will see the png. For now I’ve also added basic functionality to change the statement (the “Taste Mint” bit) to whatever you want. Just bear in mind the picture’s only 181px across and the logo takes up 50px or so of that.

So, if you add “?alt=Your Text” to the end of the above link, the button will change accordingly. Note just for clarity the entire url will then look like:

http://bendavis.me/mintpromo/button.php?alt=Your Text

So, if you were type something like this into your browser:

http://bendavis.me/mintpromo/button.php?alt=Minty%20Linux

You’d get a modified graphic just so.

Obviously, no programmer worth his salt would allow the user so much scope for editing your scripts in a working public version of this, it’s just to illustrate my point.

To further polish this, I’d use my .htaccess file to make an actual img url, something like promo-button.png so it appeared to the casual user that it really was just an image. The next step I think.

Thanks to facade47 on the forums for the font and reverend_nerd for his great button.

What do you think?

← Previous post

Next post →

3 Comments

  1. Wow, this is great! I’m in awe of your programming skills ๐Ÿ™‚

    I think something like this would work really well and shouldn’t be a problem on wordpress.com. I love the idea that the text can so easily be updated – no need for php files or even The Gimp!

    PS Added you to my blogroll.

  2. Cheers Mesanna, I think it really could work quite well. Problem is deciding where to go next. I’m thinking about some kind of configurator service. Somewhere that it’s possible to choose your image, choose your text, and then show the code. Tricky part would be caching the image so it wouldn’t be too big a drain on my hosts resources. Think it’s do-able though.

    Yet another side project… I need help!

  3. Can you Remove the time?

Leave a Reply