Archive for February, 2009

Convert Email Address To Image

Posted in PHP, Web Dev on February 27th, 2009 by Scott Weaver – 15 Comments

As a measure against spam bots and things of that nature, I’ve seen a site or two displaying e-mail addresses as images.

So to make things extremely simple, I made a very quick script to do this dynamically-


/***********************************************
* Email Address Image
* by Scott Weaver
*
* Last updated: February 27th, 2009 @ 2:30pm
*
* Converts an e-mail address to an image to
* prevent spam bots and scrapers from stealing
* it.
*
***********************************************/

/*
Requires two inputs:

u : is the username part of the email address
d : is the domain part of the email address
*/
if( !isset($_GET['u']) || !isset($_GET['d']) )
die('Please enter a valid e-mail address.');

$email = $_GET['u'] . '@' . $_GET['d'];

/*
For this font, the width is 6X the character length,
plus 1 for padding.
*/
$width = (strlen( $email )*6)+1;

// Create image w/ color
$im = imagecreate($width, 14)
or die('Cannot initialize new GD image stream');
$white = imagecolorallocate($im, 255, 255, 255);
$black = imagecolorallocate($im, 0, 0, 0);

// Write email address to image
imagestring($im, 2, 1, 0, $email, $black);

// Output & destroy
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);

Of course, you’ll notice that anyone who mods a script to look for email addresses matching the script’s parameters would be able to circumvent this little trick, but overall it should work.

What’s cool is that the script will auto-adjust the image for the width of the e-mail and it doesn’t take up much space by itself (just enough to display uppercase and lowercase letters).

Instructions

Just name the file something like ‘emailimg.php’ and upload it to your server. Once uploaded, you can reference it just like so:

<img src=”emailimg.php?u=johntheripper&d=hacker.net” />

That’s it. You’re done.

Demo

Here’s a working example:

Requirements

The only required functions are: imagecreate(), imagecolorallocate(), imagestring(), imagepng() and imagedestroy(). Basically, you just need the GD library enabled for PHP.

Improvements

I think the only improvements you could add to this script would be the ability to use different fonts, and to change the background/foreground colors. Well, that and a way to better hide the email address parameters. Maybe you can think of some that I can’t.

Launched: BeeMedia

Posted in Scott on February 23rd, 2009 by Scott Weaver – 2 Comments

Just a short note. I finally launched BeeMedia, after much debating on the topic.

In an effort to use my new-found knowledge of SEO for purposes of good awesome, I decided to finally go for the gusto and let BeeMedia set sail.

The basic idea is that it will be a collection of reviews for affiliate products, each one of them given some decent backlink power to rank individually for their keywords.

It will be a slow, tedious build but at least it will have been indexed by Google from this point on.

Scrabble Word of the Day

Posted in Funny, Photos, Weird on February 22nd, 2009 by Scott Weaver – Be the first to comment
Scrabble Word of the Day

Scrabble Word of the Day

Don’t believe me? Click the image.

Becoming Wii Fit

Posted in Scott, Technology on February 11th, 2009 by Scott Weaver – 2 Comments
Wii Fit

Wii Fit

The other day, Sarah went to Target while she was waiting for me to finish work. While she was there, she spotted a Wii Fit and surprised me with it.

We’d been looking for one for a while, and they aren’t easy to find.

So for about a week, I’ve been checking in each day to weigh myself, get a BMI reading and do some exercises. I do push-ups, boxing, super hoola-hoop, yoga, the whole nine. It’s actually pretty exhausting.

The major benefit I’ve noticed is that I haven’t had a single headache since I started using it. In a regular week, I’ll get between five and seven headaches (sometimes two in a day). This could be attributed to the Wii Fit or to the fact that, coincidentally, I began taking a multivitamin a week ago. There’s really no way to tell but I do feel much better overall.

This is the first workout routine (besides riding my bike to and from work) that I’ve actually stuck with over a few days. I usually dread any kind of strenuous workout but with the Fit — number one, I get points and number two, I can see my progress up on the screen with the handy built-in calendar.

A while back, Sarah and I decided to start going to the gym but, well, that didn’t pan out. The $90 this thing costs was nothing compared to that; we can bust it out at any time, bust a move and not bust our asses getting to the gym and back.

Overall, I’m pretty happy with it so far. I used to be able to do over 100 push-ups in a set. Right now, I’m struggling with twenty. :|

LOL Penguin Is Not Amused

Posted in Funny, Photos on February 9th, 2009 by Scott Weaver – 1 Comment
Penguin is not laughing.

Penguin is not laughing.

LOL Pandas Upside Down

Posted in Funny, Photos on February 5th, 2009 by Scott Weaver – 1 Comment
LOL Pandas at play.

LOL Pandas at play.

Shar-pei Wrinkle Remover

Posted in Funny, Photos on February 5th, 2009 by Scott Weaver – Be the first to comment
Just awesome.

Just awesome.

Bull Surprise

Posted in Funny, Photos, Weird on February 4th, 2009 by Scott Weaver – Be the first to comment
Bull Surprise

LOL

MC Escher in Water

Posted in Photos, Weird on February 3rd, 2009 by Scott Weaver – Be the first to comment
MC Escher in Water

MC Escher in Water

The lost relics of MC Escher, recovered at last.

Bull Horn In Leg

Posted in Photos, Weird on February 3rd, 2009 by Scott Weaver – 1 Comment
Bull Horn in Leg: Photoshopped? I can't tell. Either way -- Yikes.

Bull Horn in Leg: Photoshopped? I can't tell. Either way -- Yikes.