imageapi_text.png

Routines to assist ImageAPI to draw styled text as part of the ImageAPI or ImageCache pipeline.

ImageAPI_text provides additional features to supplement ImageAPI :- actions to render text on an image with many styles, effects and settings.
It publishes an API library to assist other modules to generate text on-the-fly, re-using the common image management interface defined by ImageAPI and ImageCache.

Text Styles

The styles are defined in a css-like way (a combination of SVG and CSS), and so far support effects like:

[
  fill, fill-opacity, font-size, stroke, stroke-opacity, text-shadow,
  padding (individual sides),
  positioning (top,left,right,bottom, center),
  rotation, custom effects, background-color, background-opacity,
  white-space (word-wrap), text-align
]

For a full description of text styles and effects, see imageapi_text/help/syntax_reference.html

For accessibility and design choice, a number of rendering options are available for displaying the image on the page, from straight img tag replacement to several methods of css replacement ( Leahy/Langridge, Phark, Overlay ).

To use

The module was designed for use by ImageCache Actions (DRUPAL-6--2.x text_render actions) and other (proof-of-concept) forks of signwriter, menuwriter, sprites etc

This is a library utility that produces no result on its own.

It provides features that are used by other modules, and a configuration interface to centralize management of FONTS and TEXT STYLES for the various text rendering utilities.
The configuration UI features dynamic previews of the text styles as you edit.

These settings are at:
Administer : Site configuration : ImageAPI : ImageAPI Text
/admin/settings/imageapi/text/settings

Only local images are allowed.

For Developers

Text images can be created on the fly by calling imageapi_image_create_text(), which will return an imageapi image object you can then save, manipulate or return.

HTML for rendering text can be produced by calling theme_imageapi_text(), which will return HTML that displays the rendered text, using any one of the supported methods.

To integrate text configurations in your own module, you can embed imageapi_text_style_widget() into your own form.

A visual test suite demonstrating many styles and effects is provided.
Visit /admin/settings/imageapi/text/settings/test for a demo.

Other Modules

There are a variety of other text-drawing modules in use, most famously Signwriter (Now incorporating MenuWriter). Signwriters strength is in actually applying text-image replacements to Drupal elements like headings and block titles, doing the changes to the page. However, the management of text effects has got out of hand. Textimage is a runner-up, and suitable for integration by direct coding. A few other initiatives like Dynamic rendering (Flash/SiFR) are in the same family.
This module does not extend into the alternative dynamic renderers like font embedding, SiFR, javascript or Canvas replacements, it aims to bring the current image-renderers closer to the (almost-core) ImageAPI way of building images. It provides a sharable way of getting the image-rendering family of modules to combine a little in the way they present a UI, hitching them to the ImageAPI approach that is now in Drupal7.

The aim of imageapi_text is to maybe become pluggable into signwriter, menuwriter to do the actual image generation for it, using a consistent, extensible style configuration format (not a page with 40 form fields on it)

It is written - in the first place - to support ImageCache and ImageCache Actions, where it places labels, copyright notices and titles on uploaded images. This function will be the main point of development for it.

TODO

Sprite support, generation of three-phase images on one canvas, is not far off. The method used to define styles will support inheritance, so you can define 'big-blue' style with a font, color, size, etc, then define 'big-blue-over' as a modification of the parent style, big-blue_dropshadow. This will be much easier to consistently maintain.
There is a version of SignWriter that has been ported to use this API developed as an experiment. A plugin extension to the official Signwriter project may become available later.

Project Information

Downloads