TextImage Documentation

TextImage plugin for WordPress

The TextImage plugin for WordPress displays your post text as a PNG image instead of sending it to the browser as normal HTML. You can specify the text color, background color, font, font size, and image width you want to use.Why would you want to do this? Text rendered as an image can’t be read by most robots and filters. TextImage can help ensure that your posts won’t be found by search engines and the like. If you want your posts to have the widest audience possible, TextImage probably isn’t for you. If you want to maintain a weblog for a private community and keep a low profile, TextImage might help.The idea for the TextImage plugin came to me when I read about the Great Firewall of China. This Internet censorship regime uses automated filtering to accomplish most of its dirty work. Something like TextImage might help get real information past this kind of robotic tyranny, though of course it will be useless against human censors.

Requirements

TextImage was written and tested using WordPress 2.1. I have not tested it with other versions.TextImage requires the gd module for PHP. If phpinfo() has a section for the gd module, you’re probably OK. On my CentOS 4.3 server, I used the command yum install php-gd to get the correct module installed. TextImage tries to detect whether gd is installed, and if it isn’t, TextImage won’t try to change the way WordPress displays your posts.TextImage also needs TrueType fonts. These are files with the extension .ttf. There are probably hundreds of them on your Windows machine under /windows/fonts. There are also websites that sell TrueType fonts, or let you download them for free.If your Linux server has a graphical interface installed, it probably also has some TrueType fonts. TextImage looks for them under /usr/shared/fonts. If your fonts aren’t there you will need to change the font directory on the TextImage configuration page. See Options, below.

Installation

The TextImage plugin for WordPress consists of two files. All of the WordPress-specific code is in textimage_wp.php. The creation of the actual image with word-wrapped text is done in wrapped_text_image.php. Just copy both files to the wp-content/plugins directory, then enable the TextImage plugin on the Plugins admin panel. All your posts will henceforth appear as images. Nothing is changed permanently: deactivate the plugin and they’ll reappear as normal.

Options

TextImage installs its options page under the Options tab, as you might expect. The options you can specify are:

Option Description
Image cache directory Where TextImage can save images. This directory must be writable by WordPress. Include the trailing slash.
Image cache URL The relative or absolute URL to the image cache directory.
Font directory The directory where TextImage can find TrueType fonts. TextImage will search this directory and any subdirectories for files with a ‘.ttf’ extension. This directory must be readable by the web server running WordPress. Include the trailing slash.
Image width The maximum width of the image, in pixels. 
Font height How large to make the font, in points
Text color, Background color The RGB color specified as a number – either hex (0xRRGGBB) or decimal will work
Font The ttf font file to use. TextImage generates a list of all the ttf files under /usr/shared/fonts.
Clear image cache Check this box if you want TextImage to delete all the previously-saved PNG files. Do this if you want all your posts to display using the new options.

Limitations

TextImage does not render HTML: it can’t apply multiple fonts, bolding and italics (unless everything is bold or italic), or other fancy formatting to your post. You get one font in one size and color. You can, however, force line breaks by using carriage returns.TextImage strips html tags from your post before it renders the image. It does not, however, modify the actual post. If you disable TextImage, all your HTML will work as before. TextImage renders only posts as images. Titles, comments, and all other content are still rendered as regular HTML. If there is demand I might consider changing this. Tables and other heavily formatted text won’t render correctly in TextImage.

19 Responses to “TextImage Documentation”

  1. Ben-Inside Says:

    Can Google read the text?

  2. admin Says:

    It would be possible for Google to read the text using OCR-type technology, but I don’t think Google’s robots do that now. An image search for “textimage site:harbor.sealrock.com” produces no results, but the same search on the text side is positive.

    So if you want Google to find your post, don’t use TextImage. If OCR-type recognition turns out to be an issue, I might incorporate some obscuring techniques as used in captcha applications.

  3. PaulH Says:

    Great plugin. Thank you for all the hardwork.

    I would like to modify the plugin, and maybe make the modifications available to others. But the wrapped_text_image.php file says “Copyright (c) 2002-2007 Seal Rock Research (www.sealrock.com)” Was this an oversight or is this file unabale to be redistributed.

    Tahnks

  4. admin Says:

    Thanks for the kind words, Paul.
    I retain the copyright to wrapped_text_image.php, but you may modify and/or redistribute it under the terms of the GPL. These things aren’t incompatible. In fact, owning the copyright is what makes it possible for me to enforce the terms of the GPL (you may not distribute a derivative work without also making the source code for that work available). You may not remove my copyright notice and substitute your own (not that I imagine you would do something so dishonorable).
    If you’d care to send me your changes I will be glad to consider incorporating them into the TextImage plugin, giving you credit of course. Your choice entirely.

  5. KimHoon Says:

    Hi, I think your plug-in is very useful. but I can’t use well.
    Just this error messages.

    Warning: imagepng() [function.imagepng]: Unable to open ‘http://goodmanner.oranc.co.kr/blog/wp-content/plugins/textimage011/imagecache/444e2270fcf931da4ccf2a80217f950e.png‘ for writing in /home/goodmanner/public_html/blog/wp-content/plugins/textimage.php on line 54

    Can you help me?

    ps. sorry, my ugly english. I can speak english well.

  6. admin Says:

    Hi KimHoon, your English works just fine.

    It seems that the write permissions for your image cache directory aren’t setup properly. Make sure that the process that runs your webserver has permission to write that directory. I can’t provide more specific instructions because that depends on your system.

    Good luck.

  7. bock Says:

    just what I was looking for. I did something extremely basic for tomswifty.com and was happy to find something more sophisticated out there for wordpress.

    now I have to figure out how to get the carriage returns in there…

  8. Albert Says:

    I implemented this on my own before finding this plugin… Oops. But, I won’t use it because it does not allow for a transparent background. Here is the code I found to make the bkg transparent:

    imagesavealpha($image, true);
    imagealphablending($image, false);
    $transparentColor = imagecolorallocatealpha($image, 200, 200, 200, 127);
    imagefill($image, 0, 0, $transparentColor);

    I also use imagecreatetruecolor instead of imagecreate. Not sure if that matters.

    If you were to add this, I would definitely use your plugin.

    Albert

  9. admin Says:

    Hi Albert,

    Thanks for the code. It’s a good idea and I’ll fold it in when I have a chance. Can’t say when that will be though; the paying job is taking up all my time now.

    David

  10. David Tames Says:

    It would be interesting if there was an option to choose what aspect of the post was converted to an image. you might want to do just the heading, or just a block of text. If you could specify what part of the post, as well as a section of the post, for example, things between comments like would be pretty cool. For myself, I could see using this for some parts a post, but not the whole thing. Like a list of emails.

  11. Pablo DiCiaccor Says:

    Hi, Have you dropped your dev and support for this plug-in? Wondering because it would be extremely useful to the WP community if it operated under v.2.6.
    I have tried everything, but still am only returned a plain text post.
    Hope to see this updated soon!
    Pablo

  12. admin Says:

    Howdy Pablo,

    Thanks for the question, and I apologize for being so slow. I’ve just tested and TextImage 0.21 works OK under WordPress 2.6.

    Try this:
    1. Make sure you have entered a valid cache directory (that WordPress can write to, and that has an URL on your server) in the TextImage admin screen.
    2. Set a font height, text color (try 0) and background color (try 0xffffff).
    3. Enclose the text you want converted in tags. You will need to edit in HTML mode to do this.

    Let me know if these don’t work (and if you haven’t already given up in frustration … sorry again for being so slow)

  13. Marko Says:

    Hi,

    I installed your plugin and it seems to be very usefull, I only have one problem. It doesn’t work. I use WP 2.7.1 and I use version 0.22 of your plugin. I did everything like you described in the readme, I even chmodded my whole plugin directory including all folders and files to 777. When I post something it doesn’t appear on my site! Only the title appears. When I look in the cache directory the image IS there. So what should I do to make this work? Thanks in advance,

    Marko

  14. admin Says:

    Hi Marko,

    I assume your image cache directory is in the plugins directory, so it should be accessible to Apache, since you’ve chmodded everything.

    Check that your image cache URL works. To make it easy, put a text file in the image cache, and try to bring it up in a browser using the image cache url: /test.txt.

    If that works, I’m pretty much stumped for now. It seems strange that nothing is showing up. Are you enclosing your entire post in the tags? If so, try a post with just one word between the tags, and other text around it.

    Let me know if that works or doesn’t.

  15. Marko Says:

    Well I tried to do what you said but I still have the problem.

    this is the cache directory and the test.txt can be found
    http://www.elvacom.nl/nl/wp-content/plugins/textimage/afbeeldingen/test.txt

    this is what I wanted to post:

    saasdadad

    testpiece

    jasdlkshdlakjf

    but this is what I got:
    http://elvacom.nl/nl/testpost/

    So…

    Tia for the help!

  16. admin Says:

    Hi Marko,

    When I right-click the not-found image in your test post, this is the URL:

    http://www.elvacom.nl/nl/wp-content/plugins/textimage/afbeeldingen/4e59a30ee0efa3c757badaf32f0168a6.pngnl/wp-content/plugins/textimage/afbeeldingen/995d432814cd2ed19d43b8bb66fc39f2.png

    It looks like two TextImage URLs pasted together. It even refers to two different images. I can’t see how the plugin could do that. Could you please do two things?

    1. Carefully check the post to make sure you haven’t nested the tags, or something like that.
    2. Recheck the TextImage cache URL in the TextImage Options page. Copy the whole thing and paste it into a text editor so you can see it all.

    Thanks

  17. Haroon Says:

    respected sir
    we are unable to implement this plugin
    would you kindly help us
    Haroon Abbas

  18. Sergiu Says:

    Thank you so much for this plugin! It’s excellent, very easy to use and the output has outstanding quality, keeping the image bytesize very small.

    I use it on a website with jokes. Guess what? Now people don’t copy my jokes from my site, to use on their websites.

    You’ve done a great job!

  19. Sergiu Says:

    I confirm that your plugin works with WordPress 3.0.4, as I tested today, 30 December 2010.

Leave a Reply