Plain Text To PNG

Posted by CAB 08, 09-22-2008, 06:33 AM
Hey, does anyone know a piece of code that can transform plain text that's been styled with HTML or CSS into an email? I would like to do this with my email address on different websites to prevent spam bots, any ideas?

Posted by beow, 09-22-2008, 07:06 AM
I'm not sure about proper understanding of your question. You can just make a picture with your email address and place it at your page. If you want to get it from HTML just make it there, open it in your browser, make screenshot, crop it and save it as picture.

Posted by mod_webhosting, 09-22-2008, 07:34 AM
This code will create an image from a given text. There are lots of possibilities to continue with. Alpha blending, saving file to disk instead of sending it to the browser, smart sizing the image, etc.

Posted by nixwebo, 09-22-2008, 08:15 AM
If you are going to go to the trouble of using a code to try to get around spam mail bots, you may try a code that does not include your email address. http://forum.massivelinks.com/showth...6724#post66724 This is a link to a great forum post showing how to do this.

Posted by JustinSmall, 09-22-2008, 09:14 AM
I would use AKKAI's way... It won't be styled via XHTML/CSS, it will be styled via PHP GD... but it's your best bet. php gd: http://us.php.net/gd

Posted by CAB 08, 09-22-2008, 09:44 AM
This code looks like it should do what I want but I don't understand what the 'imagestring' line means in terms of value, and how would I format the next based off CSS. The closest thing to what I want is what Facebook do with their email addresses on profiles, hope that helps.

Posted by vibrokatana, 09-22-2008, 09:57 AM
You wont get CSS styling when drawing images. At least I haven't ever seen anything like that. However you can replicate most of the text styling of CSS.

Posted by CAB 08, 09-22-2008, 12:03 PM
Sorry meant more along the lines that the styling of the original txt is retained and just turned in an image. The article above I will look into soon, thanks.

Posted by mod_webhosting, 09-23-2008, 06:17 AM
If the generic font produced by imagestring function is not satisfactory, you can use imagettftext function instead and use any TrueType font in any size you want and apply styles (italic or bold). I'm afraid I don't use Facebook so don't know how the emails are rendered on the profile pages. Although you can not achieve exactly what you wanted in the first place (seamlessly format text using CSS), I too think using these PHP functions would be your best bet.

هل استفدت من هذا الجواب؟

 أطبع هذا المقال

اقرأ أيضا

Bind an IP to a UID?

Posted by zawk, 06-22-2008, 11:34 AMI Finally had a question worth asking so I signed up......

Load Balancing 2 Web servers and 2 MySQL Servers

Posted by YYamagishi, 03-28-2008, 04:02 AMHi, I was wondering if it is possible to cluster 2 web...

What is L0 backup?

Posted by prashant1979, 06-27-2008, 09:09 AMWhat is L0 backup? How is it taken? If I have to take...

FTP Question - Limiting types of Access

Posted by webtender, 03-29-2008, 11:17 PMHello, Is it possible to setup ftp accounts that have...

Emails sent with PHP often end up in spam/junk folder

Posted by redtail, 03-07-2010, 07:32 PMMy website on VPS with Hostgator sends out emails to...