Floydian Posted May 3, 2009 Posted May 3, 2009 It's nice to have an image to display an image address instead of putting it on the page as text. This script will create an image with your email addy in it. There isn't really much to explain except for the usage of this, but first, the script: <?php function getMyEmail($site) { $emails = array( [email="'[email protected]"]'[email protected][/email]', [email="'[email protected]"]'[email protected][/email]', [email="'[email protected]"]'[email protected][/email]', ); if (!isset($emails[$site])) { return $emails[0]; } else { return $emails[$site]; } } header("Content-type: image/png"); $im = @imagecreate(200, 30) or die("Cannot Initialize new GD image stream"); $background_color = imagecolorallocate($im, 200, 200, 200); $text_color = imagecolorallocate($im, 23, 36, 90); imagestring($im, 4, 5, 5, getMyEmail($_GET['e']), $text_color); imagepng($im); imagedestroy($im); Save this script as something like email.php. Then make an img tag like so: To change the background color, edit this line: $background_color = imagecolorallocate($im, 200, 200, 200); // That's an RGB of 200,200,200 To change the text color: $text_color = imagecolorallocate($im, 23, 36, 90); // RGB of 23,36,90 To change the image size: $im = @imagecreate(200, 30) // width, height To change the font imagestring($im, 4, 5, 5, getMyEmail($_GET['e']), $text_color); // That 4 can be anything from 1 to 5, or higher // (but can only go higher if you loaded your own fonts, which is beyond the scope of this post. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.