Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
How can I add text to images in Drupal 7?
I have the following modules installed:
Imagecache Actions 7.x-1.x-dev
Imagecache Autorotate 7.x-1.x-dev
Imagecache Canvas Actions 7.x-1.x-dev
Imagecache Color Actions 7.x-1.x-dev
Imagecache Custom Actions 7.x-1.x-dev
Imagecache_actions Test Suite 7.x-1.x-dev
SmartCrop
Is there something missing? There is no action to add text.
Comment | File | Size | Author |
---|---|---|---|
imagecache.jpg | 94.47 KB | CptCotton |
Comments
Comment #1
dman CreditAttribution: dman commentedtextactions has been moved out of this module from DRUPAL-6-2.x (and therefore also D7)
The successor is to be http://drupal.org/project/imageapi_text - however that has no release in D7, and is still very beta in D6.
In short, it hasn't been built yet, and won't be (by me) until next time I need this function myself. My roadmap for this one is solid, but long, and it hasn't been a priority for a while.
Comment #2
farald CreditAttribution: farald commentedSubscribing, in case you change your mind:)
Comment #3
FreeFox CreditAttribution: FreeFox commentedI installed the module for this feature but ... it wasn't there ...
Maybe better combine all the image related modules into 1 big one.
Comment #4
Murzsubscribe
Comment #5
Axel Pressbutton CreditAttribution: Axel Pressbutton commentedSubscribing...just in case a working solution for D7 appears at any time as it's a very handy addition.
Comment #6
mandrzej CreditAttribution: mandrzej commentedsubs
Comment #7
Lostmonkey CreditAttribution: Lostmonkey commentedsubscribe
Comment #8
Jorge Navarro CreditAttribution: Jorge Navarro commentedsubscribe
Comment #9
P.Selfin CreditAttribution: P.Selfin commentedsubscribe to
Comment #10
fietserwinPlease see my (temporary) sandbox project Image Effects Text: http://drupal.org/sandbox/fietserwin/1435964. File any issue over there. When the project has stabilized enough it can (hopefully) be incorporated into the imagecache actions project.
Comment #11
Jorge Navarro CreditAttribution: Jorge Navarro commentedfietserwin, thanks, I'm getting this error:
Fatal error: Call to undefined function file_create_path() in /home/user/domain.com/sites/all/modules/image_effects_text/image_effects_text.inc on line 602
Comment #12
fietserwinThanks for reporting. An untested code path which had some D6 remains. Solved as per #1437124: Fatal error: Call to undefined function file_create_path() in /image_effects_text/image_effects_text.inc.
Comment #13
eugen80 CreditAttribution: eugen80 commentedAfter installing I got this:
Notice: Undefined variable: effect in image_effects_text_help() (line 46 of sites/all/modules/image_effects_text/image_effects_text.module).
Warning: Missing argument 2 for image_effects_text_help_inc(), called in sites/all/modules/image_effects_text/image_effects_text.module on line 46 and defined in image_effects_text_help_inc() (line 15 of sites/all/modules/image_effects_text/image_effects_text.inc).
Comment #14
eugen80 CreditAttribution: eugen80 commentedAfter adding Text effect with default settings, i got this:
Warning: is_readable() [function.is-readable]: Unable to find the wrapper "private" - did you forget to enable it when you configured PHP? in image_effects_text_find_font() (line 607 of sites/all/modules/image_effects_text/image_effects_text.inc).
Warning: imagettftext() [function.imagettftext]: Could not find/open font in image_gd_image_effects_text() (line 352 of sites/all/modules/image_effects_text/image_effects_text.inc).
Comment #15
drubbHere's an example how this could be done using an imagecache custom action (PHP). It's an adoption of the code found at http://www.9lessons.info/2011/11/php-image-and-text-watermark.html
This calculates the height and width of the watermark text and centers it on the image.
The code should work, but I haven't tested it thoroughly, because I have a bug in my ICA version: using this (or any other) custom code works with drupal's sample.png, but not with other images. I'm searching for the reason, perhaps a problem with filesystem access rights.
Hope it helps!
Comment #16
drubbFinally found the error: the code above doesn't work, because you have to do the image operations using a copy of the original image! So here's the complete working code:
Comment #17
Crystian CreditAttribution: Crystian commentedThanks! work for me!
Comment #18
immoreel CreditAttribution: immoreel commentedTo get the above to work (I got PHP Fatal error: Call to undefined function entity_load_single() in /var/www/vhosts/xxxxxxxx.com/httpdocs/sites/all/modules/imagecache_actions/utility.inc on line 289) I needed the http://drupal.org/project/entity module
Comment #19
denjell CreditAttribution: denjell commented#16 worked for me, however i am very interested in knowing how to call $fields in the custom php
"If possible, an array of owning $fields may also be available."
but how???
Comment #20
dotist CreditAttribution: dotist commentedthanks for the snippet, drubb #16 - works great.
i'm also trying to print some field info on the image - a timestamp, the viewers username and the url...
there's another suggested solution here, but it's unclear to me how they are printing the field elements that it seems they are grabbing in the code...
any further suggestion would be really appreciated!
Comment #21
shp CreditAttribution: shp commentedSubscribing for this feature.
Comment #22
fietserwinFixed and committed. The sandbox project is now a submodule of imagecache_actions.