TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 12-16-2008, 08:23 AM   #1 (permalink)
The Contributor
 
tego10122's Avatar
 
Join Date: Sep 2008
Location: Miami
Posts: 39
Thanks: 7
tego10122 is on a distinguished road
Default Text to Image

Hello, I was wondering. I wasnt sure, if I should of used the phpGD method to make "tego10122@gmail.com" or any text into a image like facebook does with the email address.
__________________
You're Everyday Graphic Artist
Twitter|GigPark|Linked In
Send a message via MSN to tego10122
tego10122 is offline  
Reply With Quote
Old 12-16-2008, 11:31 AM   #2 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Short answer: yes.

PhpGD is the way to go.
However, not everyone have it enabled, so you have to check if you have it on your webhost.
__________________
Tanax is offline  
Reply With Quote
The Following User Says Thank You to Tanax For This Useful Post:
tego10122 (12-16-2008)
Old 12-16-2008, 02:27 PM   #3 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
Wildhoney is on a distinguished road
Default

I would say that's the best approach if you're displaying it publicly. Though if registration is present on your website, then also ensure people are registered and logged in before displaying email addresses in any format.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is offline  
Reply With Quote
The Following User Says Thank You to Wildhoney For This Useful Post:
tego10122 (12-16-2008)
Old 12-17-2008, 08:48 AM   #4 (permalink)
The Contributor
 
tego10122's Avatar
 
Join Date: Sep 2008
Location: Miami
Posts: 39
Thanks: 7
tego10122 is on a distinguished road
Default

Is there any quick way I can do this?,
Code:
<?php imagefttext('$image', '$textvar'); ?>
__________________
You're Everyday Graphic Artist
Twitter|GigPark|Linked In
Send a message via MSN to tego10122
tego10122 is offline  
Reply With Quote
Old 12-17-2008, 10:14 AM   #5 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

I don't know much about imagefttext, but I'm quite sure that you should remove the ' from the parameters since you're using variables.

php Code:
<?php imagefttext($image, $textvar); ?>

Also, please use [php] or [highlight=php] tags for php-code.
__________________
Tanax is offline  
Reply With Quote
Old 12-18-2008, 05:57 PM   #6 (permalink)
The Contributor
 
Evulness's Avatar
 
Join Date: Apr 2008
Location: Tampa, FL
Posts: 65
Thanks: 6
Evulness is on a distinguished road
Default

Figured I would put my 2 cents in, since I actually just did something similar to this for my portfolio. I grabbed my function for a basic string to image, and made some minor changes and comments

PHP Code:
<?php
/*
*   Create a Image Base.
*   Sizes are in pixels(px), though you do not need to include this.
*      $var = imagecreate(width, height);
*/
$image imagecreate(20025);
/*
*   Set Image Background Color.
*   0=darkest - 255=lightest
*       imagecolorallocate(source, red, blue, green);
*/
imagecolorallocate($image200200200);
/*
*   create string color
*       imagecolorallocate(source, red, blue, green);
*/
$fontColor imagecolorallocate($image000);
/*
*   Set x-coordinate of the upper left corner of the string
*/
$startX     35//35 px from left
/*
*   Set y-coordinate of the upper left corner of the string
*/
$startY     5//5 px from top
/*
*   Set the string to be used. This is set via GET calls.
*       ex: image.php?string=YourName@Host.com
*   Or can be changed here.
*/
$string $_GET['string'];
/*
* Draw a textual string onto your source.
*   imagestring(source, font-size, X-coord, Y-coord, string, font-color);
*/
imagestring($image3$startX$startY$string$fontColor);
/*
*   Set document type.
*       This will be the type of image displayed.
*        Most common image types:
*           header("Content-type: image/jpeg");
*           header("Content-type: image/gif");
*           header("Content-type: image/png");
*/
header("Content-type: image/jpeg");
/*
*   Output your new image.
*   Depending on header type:
*       imagejpeg($source);
*       imagepng($source);
*       imagegif($source);
*/
imagejpeg($image);
/*
*   free memory associated with your image.
*/
imagedestroy($image);
?>
call that like image.php?string=YourName@Host.com in your browser, or in an image tag as your src.

Do some expiramenting with it. Change image sizes, colors, types, etc...
though like Wildhoney said... Its not good to publicly display email addresses. Site crawling bots that harvest emails, and spam them with porn ads... its not fun. The above script could, should, and did have many more security features added to it.

Oh, Where i have my imagestring(), is where you would use the imagefttext($image, $textvar) if you really wanted to. see http://us2.php.net/imagefttext for more details.
__________________
"Knowledge is power. Abuse it."~Evulness
My portfolio: www.evularts.com
Send a message via AIM to Evulness
Evulness is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Image Reflections in PHP Rendair Advanced PHP Programming 17 11-30-2011 08:41 AM
Dynamicly place text on a background image ReSpawN Advanced PHP Programming 2 04-26-2008 09:37 PM
Simple GD Code For Text With A Background Image. Alex.Prisoner Advanced PHP Programming 1 01-05-2008 11:27 PM
PDF Creation - Help! Sam Granger General 7 10-31-2007 11:32 AM


All times are GMT. The time now is 10:43 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design