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.

這篇文章有幫助嗎?

 列印本文

Also Read

Create A Real Time Web Page

Posted by batulang, 08-14-2006, 06:34 AMHi Everybody, I was thinking is that possible to...

PlanetDomain API - Frustrating - Waiting for almost a decade!

Posted by MrLeN, 09-21-2008, 10:55 AMI have been a PlanetDomain reseller for about 8 years or so...

Command line to show mysql processes?

Posted by mrzippy, 10-30-2012, 11:43 AMHello, What is the command to show active mysql...

[PHP] - Why forums don't use $_SESSION variables ?

Posted by hadoken, 03-13-2007, 02:46 PMHello, I hope everybody is fine. I take a look on some...

Any security risks with setting up server on home network?

Posted by Papa G, 06-28-2008, 04:09 PMAny security risks with setting up server on home network?...