Hi wundo and everyone. I recently found a need to have extensive text-to-image manipulations on a current project. Because 'textimage' is such a fitting name and the module description has long said that this would be a coming feature, I decided to undertake this as an upgrade to Drupal 5 (since that's what we'll be using).
Upgrades from the 4.7 version should be smooth, just install and run update.php. This is a full replacement for the existing textimage module, though the primary purpose of the module has shifted from providing a captcha challenge to making images from dynamic text. All of the existing captcha code has been moved to an include file which is called only if the captcha.module is also present.
The new text-to-image functionality is highly based on the imagecache.module. Administrators create 'presets' of text to image manipulations, then images are dynamically generated based on the URL. So you could create a preset called 'header_title' and set various options within that preset. (i.e. Arial, 30px, white, on header.png at x position 100 and y position 10). Then you can directly call {files_directory}/textimage/header_title/hello_world.png. A PNG format graphic is generated with the text "hello world" on top of header.png.
Capabilities for generated images include:
- Use any TTF font uploaded to the specified font directory
- Font size
- Font color
- Text rotation
- Case conversion
- Text outline
- Image margins
- Background colors (plus transparency for gif and png images)
- Background images (png, jpg, gif format)
- Use other presets as background images
The last one gets pretty crazy when you start combining text images. You could create three different presets, and have them use each other as backgrounds. Then use {files}/textimage/foo/bar/baz.png to access the image. baz will use preset 1, bar will use preset 2, and foo will use preset 3. Enabling you to use multiple dynamic fonts on a single image.
After installation, complete help with examples is available at admin/help/textimage.
If this isn't the charted course for textimage, I'll gladly release as a separate module, but I'd love to see these changes get into textimage. Thanks!
Nate
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | textimage_2.0.zip | 15.53 KB | peterx |
| #12 | textimage_1.zip | 35.9 KB | quicksketch |
| #2 | textimage_0.zip | 34.63 KB | quicksketch |
| #1 | textimage_revamp.patch | 85.37 KB | quicksketch |
| textimage.zip | 35.83 KB | quicksketch |
Comments
Comment #1
quicksketchHere's a patch form for viewing the (extensive) differences. Please don't actually use this patch as the help images are not included with the patch.
Comment #2
quicksketchA couple small changes to documentation and allows the fonts directory be outside the files directory.
Comment #3
filiptc commentedI just installed your version of the module and intended to use it with the D5 patched captcha but I get 'Captcha Image: you will need to recognize the text in it.' in the placeholder of the captcha textimage instead. The admin menu seems to work flawlessly though.
Phil
Comment #4
quicksketchThanks for the update. The captcha works fine on my machine. Can you view the source of the document, find the captcha image and view the URL directly? Maybe it can provide a useful error of some sort (crosses fingers). Thanks!
Comment #5
filiptc commentedNever mind... I can't beleive forgetting to set permissions is still happening to me after a year using drupal... lol
Works great, nice job.
+1 to get this into textimage.
Phil
Comment #6
filiptc commentedSetting to 'needs review' again although I'd be glad to see it RTBC.
Comment #7
wundo commentedGreat Work Nathan ;)
I gonna start test it today, there is anyway to port it to Drupal 4.7?
This is what Arnab had in mind when released Textimage as an stand-alone module, I totally agree with his thoughts ;)
If we could back port it, the majorities of textimage's users would take the advantage of this.
Could you help me with that??
I'm planning some improvements in the Captcha API before the port to Drupal 5, and I think it is a good idea to port those changes in textimage to 4.7 first (then we could test the modules together).
Really thank you,
Fabiano Sant'Ana
Comment #8
wundo commentedComment #9
quicksketchHey Fabiano, yeah... I suppose the changes could be back-ported. I'm not working with 4.7 much anymore these days so I didn't see much interest in it. However, it's actually easier to back port the changes now and keep the code consistent than to start with 4.7 and port to 5. I'll port the changes to 4.7 and we'll just replace the entire project with substantially updated code.
Comment #10
wundo commentedI released an captcha for drupal 5 (I decided to make the api changes in the Drupal 5 version) and now I'm testing your textimage ;)
IF you didn't started yet, I think that we don't need to worry about back-port as Drupal 5 first release seen that will be released soon.
Comment #11
wundo commentedHey nathan,
Captcha works, but I cannot make the other function works here :(
What I'm doing wrong?
the patch files/textimage doesn't seen to work :(
Comment #12
quicksketchHey wundo, I've found a couple more bugs that needed to be fixed. If your fonts were stored outside the files directory the files/textimage path wouldn't produce any output. This should be corrected in this version. Let me know if it's still not working for you.
Comment #13
peterx commentedWhat is the performance impact? If I use the new textimage purely for captcha, will textimage work with no calls to the database?
petermoulding.com/web_architect
Comment #14
peterx commentedI like the idea of splitting the code so less code is loaded when in use. I use textimage only for Captcha so moved captcha.inc back into textimage.module. I then moved the administration stuff out so that the regular usage will have only the rendering stuff. textimage.module reduces from 46k to 40k and there is no separate load for captcha. The result is enclosed as Textimage 2.0.
To make it smaller, you could make presets an option and not load the preset code if not used. Could be an admin option. If nobody defines a preset then leave a variable set and not load the code. Have an option along the line of:
(.) Captcha
( ) Captcha and presets
( ) Presets
Comment #15
quicksketchDrupal shouldn't make any additional queries if you're not using the preset features. So there isn't much of a performance impact there. If in fact we're talking about options to disable an entire half of the module, then these features should be split into a different module entirely. However, I think this new functionality is more in line with the features textimage should have than simply providing a captcha.
Comment #16
wundo commentedReleased ;)
Comment #17
wundo commentedComment #18
quicksketchWoohoo!
Comment #19
fellow commentedhi, i'm using textimage-5.x-1.2.tar.gz module, but i don't know what to type in "TrueType Fonts Path:" and " Background Image Path:". For ex. i have font folder in files. What is the path? /files/font don't work (The entered font path is invalid). Thanks.
Comment #20
CmputrAce commentedOK, I'm missing something.
Fonts are in sites/all/fonts, backgrounds in sites/all/images, preset is NimbusT18. No errors in setup that I can tell. My files folder is not in the drupal structure (private downloads).
I open a browser window and type alia/home/textimage/NimbusT18/test.png and get
'Page Not Found'. (it's on my home server, alia, and 'home' is where the drupal setup is).
Thoughts?
Comment #21
quicksketchUsing the dynamic textimage features currently requires public file transfer on your site. You can make a separate feature request for this. Sorry!