You are here

README.txt in Textimage 7.3

-----------------
Textimage 7.x-3.x
-----------------

Textimage adds text to image functionality using GD2 and Freetype, enabling
users to create crisp images on the fly for use as theme objects, headings or
limitless other possibilities.

Textimage was originally written by Fabiano Sant'Ana (wundo).
- http://chuva-inc.com

Co-maintained by:
- Stuart Clark (Deciphered) http://stuar.tc/lark
- Mondrake http://drupal.org/user/1307444


Compatibility
-------------
Textimage 3 is a major rewrite of Textimage, and is NOT compatible with
earlier versions. Install the module in an environment where there is
no 7.x-2.x installed.


Quick start instructions
------------------------
- Check requirements (below) and install / configure the modules needed.
- Install and enable the module.
- Check the Configuration page (Administration->Configuration->Media->
  Textimage) and setup.
- Ensure at least one font file is available.
- Create an image style (Administration->Configuration->Media->Image Styles)
  and use Textimage effects in combination with other effects as needed.
- Change a field of a content type (Administration->Structure->Content Types->
  {your type}->Manage Display) to be represented by a Textimage:
    - select 'Textimage' in the format dropdown (applicable to Text and Image
      fields
    - click on the gear icon
    - select the image style you created earlier from the dropdown displayed
- Your field content is now presented as a (Text)image!


-------------------------------------------------------------------------------


Features
--------
* Provides three image effects for use in Drupal's Image system:
  * Textimage text
    * Default text accepts tokens that are resolved at run-time.
    * Support for TrueType fonts and OpenType fonts.
    * Rotate your text at any angle.
    * Configurable opacity in text and background color.
    * Outline and shadow effects.
    * Line-level text alignment (left/center/right).
    * Line spacing (leading).
    * Case format conversion.
    * Easy selection of the text position on the background image.
    * Options to manage text overflow against background.
  * Textimage background
    * Background can be defined as a color, or as a fixed image, or as the
      result of the previous image effects.
    * Exact/relative sizing of the image.
  * Textimage GIF transparency
    * Define a color for GIF transparency, so to allow transparent background
      for Textimage images. Only works within the set of Textimage effects.
* Field display formatters for Text and Image fields.
* Textimage API to generate Textimage images programmatically.
* Textimage tokens to retrieve URI/URL of generated Textimage images.
* Integrates with Metatag to use Textimage tokens in meta tags.


Requirements
------------
- Drupal 7.23 or later, with Color and Image modules enabled
- GD2 and FreeType libraries
- Private file system configured
- ImageCache Actions
- ImageCache Canvas Actions

Recommended modules, for a feature rich set:
- @font-your-face       (7.x-2.6 or later)
- Media                 (7.x-1.2 or later)
- Jquery Colorpicker    (7.x-1.0-rc1 or later)
- Token                 (7.x-1.5 or later)

Integration with modules:
- Metatag               (7.x-1.0-beta8 or later)

Installation instructions (long version)
----------------------------------------
- Ensure that your Drupal installation has a private file system to write
  to. Check (Administration->Configuration->Media->File system), the
  'Private file system path' field should be filled in.
- Consider recommended modules:
  - @font-your-face - if you use this module, all 'local fonts' installed
    and enabled on your system can be used by Textimage.
  - Media - if you use this module, background images can be selected via
    the media browser form.
  - Jquery Colorpicker - this module provides a user-friendly way for
    selecting colors
  - Token - this module allows to list available tokens when entering the
    default text for a 'Textimage text' effect.
- Install and enable Textimage.
- Check Textimage configuration page (Administration->Configuration->
  Media->Textimage):
  - Textimage store location - Textimage needs a structure of directories
    to store cached images, and fonts and background images if either
    @font-your-face or Media are not used. Select the file system where
    this structure can be stored. Private is recommended.
  - Fonts - select the module that will manage fonts in Textimage, and a
    default font to use. Make sure at least one font file is available.
  - Background Images - select the module that will manage background
    images in Textimage.
  - Colors - select the mode for selecting colors in Textimage. Either use
    Jquery colorpicker if the module is installed, or a plain textbox.


-------------------------------------------------------------------------------


Creating Textimage image styles
-------------------------------
- Textimage extends Drupal image system providing additional image effects.
- Just combine Textimage effects with any other image effect to deliver
  the result needed in a image style (Administration->Configuration->Media->
  Image Styles).
- Image styles using Textimage effects are extended to collect Textimage
  only options:
  - Image destination - allows to specify in which file system the derivative
    images (i.e. the final output) shall be stored. By default, this is
    the same destination as specified in 'Textimage store location' in
    configuration, but can be set to alternative file systems (e.g. Amazon
    S3 etc.)


Image effect: Textimage text
----------------------------
- Refresh preview. Allows to refresh the effect preview without leaving
  the effect settings. Optionally, 'Visual aids in preview' will display
  the bounding boxes of the text elements to help finding proper sizing
  and padding setup.
- Default text. Accepts tokens that are resolved at run-time. If Token
  module is installed, a list of available tokens is displayed on the
  effect form. See the 'Using Textimage field formatters and tokens'
  section below for more information regarding the usage of tokens.
- Font
  - Font. Select from a list of available fonts.
  - Size. In points.
  - Rotation. In degrees.
  - Color. Opacity can be defined.
  - Outline. 'Outlines' the font. Size, color, opacity of the outline
    can be specified.
  - Shadow. Provides a shadow effect to the font. Offset, elongation,
    color, opacity of the shadow can be specified.
- Text
  - Maximum width. Maximum width of the text image, inclusive of padding.
    Text lines wider than this will be wrapped. Leave blank to disable
    wrapping. In case of rotation, the width of the final image rendered
    will differ, to accommodate the rotation. If you need a strict
    width/height, add image resize/scale/crop effects afterwards.
  - Fixed width. If checked, the width will always be equal to the maximum
    width.
  - Text alignment.
  - Line spacing. Additional space between text lines.
  - Case format. Specifies conversion of text before rendering.
- Layout
  - Position. Defines where in the source image the text should be placed.
    Beside an anchor selection, additional offset can be specified. In case
    the text element overflows the underlying image, the options are to
    extend the underlying image, crop the overflowing text, or scale the
    text to fit in the underlying image.
  - Padding. Specifies if the text should be padded additionally within the
    text box (the part of the image where the text is laid).
  - Background color. Color / opacity of the text box.


Image effect: Textimage background
----------------------------------
- Background image - can be defined as a color, or as a fixed image, or as the
  result of the previous image effects.
- Background color - either used as the background color, or to fill in gaps
  coming from resizing.
- Exact size - In case the size specified is smaller than the source, the
  options are to scale/crop/resize the image.
- Relative size - Basically adds to the image a border of the size specified.


Image effect: Textimage GIF transparency
----------------------------------------
- Color - the color specified will be used to set GIF transparency, so to
  allow transparent background for Textimage images. Only works within the set
  of Textimage effects.


-------------------------------------------------------------------------------


Using Textimage image styles
----------------------------

1. via Content Type field display formatters

   - Access 'Content type' administration features via Administration->
     Structure->Content Types
   - Select the content type for which you want to manage a Textimage field
     (e.g. Article, Basic page, etc.)
   - If you need to create a new field, in the 'Manage Fields' tab, add a new
     field of type 'Text' (or 'Long text', or 'Long text and summary') or
     'Image'
   - In the 'Manage Display' tab, select a 'Textimage' format for the field
     created above (or any existing one)
   - Click on the gear icon
   - Select from the 'Image style' dropdown the image style you want to use to
     represent the content as a Textimage
   - If the field is a multi-value text field, an option is presented to select
     whether to generate a single image or multiple images. In the first case,
     the formatter will pass sequentially each field value to a separate image
     style's 'Textimage text' effect. Each effect must define where the text
     should be placed on the image. In the second case, each field value will
     be passed to a separate instance of the image style, and only the first
     'Textimage text' effect will be used to produce a separate styled image.
   - Optionally, select from the 'Link image to' dropdown whether the Textimage
     should be clickable, linking to either the node content or the image file.
     By default, the Textimage is not linked.
   - Optionally, enter a value for the image 'alt' attribute in the 'Alternate
     text' textbox. This text will be used by screen readers, search engines,
     or when the image cannot be loaded. Tokens can be used.
   - Optionally, enter a value for the image 'title' attribute in the 'Title'
     textbox. The title is used as a tool tip when the user hovers the mouse
     over the image. Tokens can be used.

2. via URL:

   Create an image with the URL in following format:
   http://[your_domain]{/your_drupal_directory}/[path_to_public_files]/textimage/[style_name]/[Text_0]/[Text_1]/.../[Text_n].[extension]

   In a standard installation, [path_to_public_files] = 'sites/default/files'.

   Text_0...n - each string will be consumed by a textimage_text effect in the
   sequence specified within the image style.

   Note: This method can only be used by users with the 'generate textimage url
   derivatives' permission. This is to prevent Anonymous users from creating
   random images. If you need dynamically created Textimages, it is strongly
   advised you use one of the methods detailed below.

3. Programmers/themers - calling Textimage theme() functions:

   There are three theme functions that can be used to render HTML of Textimage
   images:

   -----------------------
   'textimage_style_image'
   -----------------------
   This is used for Textimages based on a stored image style. Example:

    theme(
      'textimage_style_image',
      array(
        'style_name' => 'my_image_style',
        'text'   => array('text1', 'text2'),
        'format' => 'png',
        'alt'    => 'Alternate text',
        'title'  => 'Image title',
        'attributes' => array(),
        'caching' => TRUE,
        'node' => NULL,
        'source_image_file' => NULL,
      ),
    ));

    Variables:
    - style_name - the image style name.
    - text - an array of text strings, with unresolved tokens; each string
      of the array will be consumed by a textimage_text effect in the sequence
      specified within the image style.
    - format - the file format of the resulting image (png/gif/jpg/jpeg).
    - alt - the image alternate text. This text will be used by screen readers,
      search engines, or when the image cannot be loaded. Tokens can be used.
    - title - the text to be displayed when hovering the image on the browser.
      Tokens can be used.
    - attributes - associative array of attributes to be placed in the img tag.
    - caching - if set to TRUE, the image will be cached for future accesses;
      otherwise, the image will be stored in textimage_store and deleted on
      cron run.
    - node - a node entity. It is used for resolving the tokens in the text
      effects.
    - source_image_file - a file entity. It is used for resolving the tokens
      in the text effects.

   ------------------------
   'textimage_direct_image'
   ------------------------
   This is used for Textimages based on a image style created programmatically.
   Example:

    theme(
      'textimage_direct_image',
      array(
        'effects' => array(),
        'text'   => array('text1', 'text2'),
        'format' => 'png',
        'alt'    => 'Alternate text',
        'title'  => 'Image title',
        'attributes' => array(),
        'caching' => TRUE,
      ),
    ));

    Variables:
    - effects - an array of image style effects. Given a $style image style
      array, corresponds to the $style['effects'] key. You can dynamically
      load and manipulate this array and pass it over to this theme, with no
      need to save it back to storage.
    - text - an array of text strings, with unresolved tokens; each string
      of the array will be consumed by a textimage_text effect in the sequence
      specified within the image style.
    - format - the file format of the resulting image (png/gif/jpg/jpeg).
    - alt - the image alternate text. This text will be used by screen readers,
      search engines, or when the image cannot be loaded. Tokens can be used.
    - title - the text to be displayed when hovering the image on the browser.
      Tokens can be used.
    - attributes - associative array of attributes to be placed in the img tag.
    - caching - if set to TRUE, the image will be cached for future accesses;
      otherwise, the image will be stored in textimage_store and deleted on
      cron run.

   ---------------------
   'textimage_formatter'
   ---------------------
   This is the low level theme function used by Textimage to render HTML. It
   also allows to specify wrapping the <img> tag in a container <div> tag,
   and/or wrapping the entire output in an anchor tag.

    Variables:
    - textimage - A fully processed Textimage object. If this variable is set,
      the theme function will use this object to render the image, and the
      variables style_name, effects, text, format, caching, node,
      source_image_file, target_uri will be ineffective.
    - style_name - the image style name. If specified, it will override any
      value passed in the 'effects' variable.
    - effects - an array of image style effects. Given a $style image style
      array, corresponds to the $style['effects'] key.
    - text - an array of text strings, with unresolved tokens; each string
      of the array will be consumed by a textimage_text effect in the sequence
      specified within the image style.
    - format - the file format of the resulting image (png/gif/jpg/jpeg).
    - caching - if set to TRUE, the image will be cached for future accesses;
      otherwise, the image will be stored in textimage_store and deleted on
      cron run.
    - node - a node entity. It is used for resolving the tokens in the text
      effects.
    - source_image_file - a file entity. It is used for resolving the tokens
      in the text effects.
    - target_uri - allows to specify the URI where the textimage file should be
      stored. If specified, the automatic URI generation performed by Textimage
      is bypassed and caching disabled.
    - alt - the image alternate text. This text will be used by screen readers,
      search engines, or when the image cannot be loaded. Tokens can be used.
    - title - the text to be displayed when hovering the image on the browser.
      Tokens can be used.
    - attributes - associative array of attributes to be placed in the img tag.
    - image_container_attributes - if specified, the <img> tag will be wrapped
      in a <div> container, whose attributes will be set to the array passed
      here. Any attribute having the placeholder '#textimage_derivative_url#'
      will be resolved at run-time with the actual Textimage URL.
    - href - if specified, the entire output will be wrapped in a <a> anchor,
      whose href will be set to the value passed here. If
      '#textimage_derivative_url#' is passed, the href will be resolved at
      run-time with the actual Textimage URL.

4. Programmers - calling API functions:

    Programmers can invoke directly TextimageImager::getImageUri() or
    TextimageImager::getImageUrl() to get respectively the URI or the full
    URL of a Textimage generated via the input parameters. Example:

    $my_textimage_uri = TextimageImager::getImageUri(
      $style_name,
      $effects_outline,
      $text,
      $extension,
      $caching,
      $node,
      $source_image_file,
      $target_uri
    );

    Variables:
    - $style_name - the image style name. If set to NULL, then
      $effects_outline is expected.
    - $effects_outline - a subset of an array of image style effects. Given
      a $style['effects'] array, corresponds to the array of 'name' and 'data'
      keys of each element. You can use the helper function
      TextimageStyles::getStyleEffectsOutline($style_name) to get this array
      based on a style name. If set to NULL then $style is expected.
    - $text - an array of text strings, with unresolved tokens; each string
      of the array will be consumed by a textimage_text effect in the sequence
      specified within the image style.
    - $extension - (optional) the file format of the resulting image
      (png/gif/jpg/jpeg). Defaults to 'png'.
    - $caching - (optional) if set to TRUE, the image will be cached for
      future access; otherwise, the image will be stored in
      textimage_store/uncached and deleted on cron run. Defaults to TRUE.
    - $node - (optional) a node entity. It is used for resolving the tokens
      in the text effects.
    - $source_image_file - (optional) a file entity. It is used for resolving
      the tokens in the text effects.
    - $target_uri - (optional) specifies the URI where the textimage file
      should be stored. Allows to bypass the automatic URI generation performed
      by Textimage. NOTE: It disables caching, as, given an URI, there is no
      control on the actual text that gets into the image.


-------------------------------------------------------------------------------


Using Textimage field formatters with tokens
--------------------------------------------

There are specific pre-conditions for text tokens to be resolved into full
text. Some tokens are 'general' (e.g. current date and time, site name, etc.)
but others require the 'context' that has to be accessed to retrieve
information, like a user, or a node, etc. When the context is missing, the
token can not be resolved.

Textimage provides context for 'user', 'node' and 'file' tokens through
its field display formatters. Textimage provides built-in field formatters
for the following field types: 'image', 'text', 'text_with_summary',
'text_long'.

If you select a Textimage formatter for a 'text' field, Textimage will use
the text entered in the field to produce an image with it. In the field text
you can enter the tokens directly, or [textimage:default] in which case
Textimage will just fetch and use the default text entered in the image effect
UI. If your image style is built with multiple 'Textimage text' effects, the
text field needs to be multi-value as well. Each text field value will be used
by one 'Textimage text' effect in the same sequence.
Tokens will be resolved against the 'node' (current content) and 'user' token
types.

If you select a Textimage formatter for an 'image' field, Textimage will use
the text entered in the default text in the image effect UI to produce the
image. In this case, tokens will be resolved against 'node', 'user' and 'file'
token types, where the 'file' is the original image uploaded in the content.

Programmers can develop additional field display formatters, using the lower
level APIs to pass 'node' or 'file' objects to be resolved. 'User' is always
the current user within the scope of the Textimage image building process.


-------------------------------------------------------------------------------


Textimage tokens
----------------

Textimage provides two tokens that can be used to retrieve the location where
a Textimage image has been stored:

A token to retrieve the URL of a Textimage image

[textimage:url:field{:display}{:sequence}]

and the URI equivalent

[textimage:uri:field{:display}{:sequence}]

where:
- 'field' is the machine name of the field for which the Textimage is
  generated (e.g. 'body', or 'field_my_field');
- 'display' is an optional indication of the display view mode (e.g. 'default',
  'full', 'teaser', etc.); 'default' is used if not specified;
- 'sequence' is an optional indication of the URL/URI to return if Textimage
  produces more images for the same field (like e.g. in a multi-value Image
  field); if not specified, a comma-delimited string of all the URLs/URIs
  generated will be returned.

Textimage tokens can be used with the Metatag module to specify e.g. URL
meta tags.


-------------------------------------------------------------------------------


Delta - 3.x vs. 2.x
-------------------

- Leverage Image and Tokens features that are embedded in core Drupal 7.

- Drop the preset concept and db schema and use instead the Image concepts:
  styles and effects. This finally allows Textimage to use any image effect
  to build the final image - leveraging a wide library of image effects
  provided by core and other contrib modules. Also, it allows core Image
  module to use Textimage effects.

- Move all primitive image functions to toolkit specific includes, allowing to
  potentially use alternative toolkits (other than GD).

- Implement Drupal 7 field formatters for Text and Image fields.

- Implement a derivative delivery mechanism specific to Textimage - enabling
  usage of scheme wrappers (public, private, ...) to indicate storage
  destination of image files, and providing a framework to leverage tokens.

- Enable Tokens substitution at runtime in the text.

- Implement a direct text to image theme (i.e. enable producing a textimage
  with no predefined style!).

- Enhance the text overlay effects

- Integrate with Imagecache Actions module to leverage its effects and
  functions (dependency).

- Optional @font-your-face module integration for font management.

- Optional Media module integration for background image management.

- Optional jQuery Colorpicker module integration for color selection in
  effects' admin forms.

- Documented API to produce Textimage images programmatically.

- Textimage tokens to retrieve URI/URL of generated Textimage images.


Wishlist
--------
- allow token resolution in theme_textimage_formatter href.
- textimage_text effect - if elements with different opacity overlap (e.g.
  in case of shadow/outline or if background color is opaque itself), then
  we get a combined color effect. One may want to refer each element's
  opacity to the original image instead.
- an ImageMagick toolkit implementation.

File

README.txt
View source
  1. -----------------
  2. Textimage 7.x-3.x
  3. -----------------
  4. Textimage adds text to image functionality using GD2 and Freetype, enabling
  5. users to create crisp images on the fly for use as theme objects, headings or
  6. limitless other possibilities.
  7. Textimage was originally written by Fabiano Sant'Ana (wundo).
  8. - http://chuva-inc.com
  9. Co-maintained by:
  10. - Stuart Clark (Deciphered) http://stuar.tc/lark
  11. - Mondrake http://drupal.org/user/1307444
  12. Compatibility
  13. -------------
  14. Textimage 3 is a major rewrite of Textimage, and is NOT compatible with
  15. earlier versions. Install the module in an environment where there is
  16. no 7.x-2.x installed.
  17. Quick start instructions
  18. ------------------------
  19. - Check requirements (below) and install / configure the modules needed.
  20. - Install and enable the module.
  21. - Check the Configuration page (Administration->Configuration->Media->
  22. Textimage) and setup.
  23. - Ensure at least one font file is available.
  24. - Create an image style (Administration->Configuration->Media->Image Styles)
  25. and use Textimage effects in combination with other effects as needed.
  26. - Change a field of a content type (Administration->Structure->Content Types->
  27. {your type}->Manage Display) to be represented by a Textimage:
  28. - select 'Textimage' in the format dropdown (applicable to Text and Image
  29. fields
  30. - click on the gear icon
  31. - select the image style you created earlier from the dropdown displayed
  32. - Your field content is now presented as a (Text)image!
  33. -------------------------------------------------------------------------------
  34. Features
  35. --------
  36. * Provides three image effects for use in Drupal's Image system:
  37. * Textimage text
  38. * Default text accepts tokens that are resolved at run-time.
  39. * Support for TrueType fonts and OpenType fonts.
  40. * Rotate your text at any angle.
  41. * Configurable opacity in text and background color.
  42. * Outline and shadow effects.
  43. * Line-level text alignment (left/center/right).
  44. * Line spacing (leading).
  45. * Case format conversion.
  46. * Easy selection of the text position on the background image.
  47. * Options to manage text overflow against background.
  48. * Textimage background
  49. * Background can be defined as a color, or as a fixed image, or as the
  50. result of the previous image effects.
  51. * Exact/relative sizing of the image.
  52. * Textimage GIF transparency
  53. * Define a color for GIF transparency, so to allow transparent background
  54. for Textimage images. Only works within the set of Textimage effects.
  55. * Field display formatters for Text and Image fields.
  56. * Textimage API to generate Textimage images programmatically.
  57. * Textimage tokens to retrieve URI/URL of generated Textimage images.
  58. * Integrates with Metatag to use Textimage tokens in meta tags.
  59. Requirements
  60. ------------
  61. - Drupal 7.23 or later, with Color and Image modules enabled
  62. - GD2 and FreeType libraries
  63. - Private file system configured
  64. - ImageCache Actions
  65. - ImageCache Canvas Actions
  66. Recommended modules, for a feature rich set:
  67. - @font-your-face (7.x-2.6 or later)
  68. - Media (7.x-1.2 or later)
  69. - Jquery Colorpicker (7.x-1.0-rc1 or later)
  70. - Token (7.x-1.5 or later)
  71. Integration with modules:
  72. - Metatag (7.x-1.0-beta8 or later)
  73. Installation instructions (long version)
  74. ----------------------------------------
  75. - Ensure that your Drupal installation has a private file system to write
  76. to. Check (Administration->Configuration->Media->File system), the
  77. 'Private file system path' field should be filled in.
  78. - Consider recommended modules:
  79. - @font-your-face - if you use this module, all 'local fonts' installed
  80. and enabled on your system can be used by Textimage.
  81. - Media - if you use this module, background images can be selected via
  82. the media browser form.
  83. - Jquery Colorpicker - this module provides a user-friendly way for
  84. selecting colors
  85. - Token - this module allows to list available tokens when entering the
  86. default text for a 'Textimage text' effect.
  87. - Install and enable Textimage.
  88. - Check Textimage configuration page (Administration->Configuration->
  89. Media->Textimage):
  90. - Textimage store location - Textimage needs a structure of directories
  91. to store cached images, and fonts and background images if either
  92. @font-your-face or Media are not used. Select the file system where
  93. this structure can be stored. Private is recommended.
  94. - Fonts - select the module that will manage fonts in Textimage, and a
  95. default font to use. Make sure at least one font file is available.
  96. - Background Images - select the module that will manage background
  97. images in Textimage.
  98. - Colors - select the mode for selecting colors in Textimage. Either use
  99. Jquery colorpicker if the module is installed, or a plain textbox.
  100. -------------------------------------------------------------------------------
  101. Creating Textimage image styles
  102. -------------------------------
  103. - Textimage extends Drupal image system providing additional image effects.
  104. - Just combine Textimage effects with any other image effect to deliver
  105. the result needed in a image style (Administration->Configuration->Media->
  106. Image Styles).
  107. - Image styles using Textimage effects are extended to collect Textimage
  108. only options:
  109. - Image destination - allows to specify in which file system the derivative
  110. images (i.e. the final output) shall be stored. By default, this is
  111. the same destination as specified in 'Textimage store location' in
  112. configuration, but can be set to alternative file systems (e.g. Amazon
  113. S3 etc.)
  114. Image effect: Textimage text
  115. ----------------------------
  116. - Refresh preview. Allows to refresh the effect preview without leaving
  117. the effect settings. Optionally, 'Visual aids in preview' will display
  118. the bounding boxes of the text elements to help finding proper sizing
  119. and padding setup.
  120. - Default text. Accepts tokens that are resolved at run-time. If Token
  121. module is installed, a list of available tokens is displayed on the
  122. effect form. See the 'Using Textimage field formatters and tokens'
  123. section below for more information regarding the usage of tokens.
  124. - Font
  125. - Font. Select from a list of available fonts.
  126. - Size. In points.
  127. - Rotation. In degrees.
  128. - Color. Opacity can be defined.
  129. - Outline. 'Outlines' the font. Size, color, opacity of the outline
  130. can be specified.
  131. - Shadow. Provides a shadow effect to the font. Offset, elongation,
  132. color, opacity of the shadow can be specified.
  133. - Text
  134. - Maximum width. Maximum width of the text image, inclusive of padding.
  135. Text lines wider than this will be wrapped. Leave blank to disable
  136. wrapping. In case of rotation, the width of the final image rendered
  137. will differ, to accommodate the rotation. If you need a strict
  138. width/height, add image resize/scale/crop effects afterwards.
  139. - Fixed width. If checked, the width will always be equal to the maximum
  140. width.
  141. - Text alignment.
  142. - Line spacing. Additional space between text lines.
  143. - Case format. Specifies conversion of text before rendering.
  144. - Layout
  145. - Position. Defines where in the source image the text should be placed.
  146. Beside an anchor selection, additional offset can be specified. In case
  147. the text element overflows the underlying image, the options are to
  148. extend the underlying image, crop the overflowing text, or scale the
  149. text to fit in the underlying image.
  150. - Padding. Specifies if the text should be padded additionally within the
  151. text box (the part of the image where the text is laid).
  152. - Background color. Color / opacity of the text box.
  153. Image effect: Textimage background
  154. ----------------------------------
  155. - Background image - can be defined as a color, or as a fixed image, or as the
  156. result of the previous image effects.
  157. - Background color - either used as the background color, or to fill in gaps
  158. coming from resizing.
  159. - Exact size - In case the size specified is smaller than the source, the
  160. options are to scale/crop/resize the image.
  161. - Relative size - Basically adds to the image a border of the size specified.
  162. Image effect: Textimage GIF transparency
  163. ----------------------------------------
  164. - Color - the color specified will be used to set GIF transparency, so to
  165. allow transparent background for Textimage images. Only works within the set
  166. of Textimage effects.
  167. -------------------------------------------------------------------------------
  168. Using Textimage image styles
  169. ----------------------------
  170. 1. via Content Type field display formatters
  171. - Access 'Content type' administration features via Administration->
  172. Structure->Content Types
  173. - Select the content type for which you want to manage a Textimage field
  174. (e.g. Article, Basic page, etc.)
  175. - If you need to create a new field, in the 'Manage Fields' tab, add a new
  176. field of type 'Text' (or 'Long text', or 'Long text and summary') or
  177. 'Image'
  178. - In the 'Manage Display' tab, select a 'Textimage' format for the field
  179. created above (or any existing one)
  180. - Click on the gear icon
  181. - Select from the 'Image style' dropdown the image style you want to use to
  182. represent the content as a Textimage
  183. - If the field is a multi-value text field, an option is presented to select
  184. whether to generate a single image or multiple images. In the first case,
  185. the formatter will pass sequentially each field value to a separate image
  186. style's 'Textimage text' effect. Each effect must define where the text
  187. should be placed on the image. In the second case, each field value will
  188. be passed to a separate instance of the image style, and only the first
  189. 'Textimage text' effect will be used to produce a separate styled image.
  190. - Optionally, select from the 'Link image to' dropdown whether the Textimage
  191. should be clickable, linking to either the node content or the image file.
  192. By default, the Textimage is not linked.
  193. - Optionally, enter a value for the image 'alt' attribute in the 'Alternate
  194. text' textbox. This text will be used by screen readers, search engines,
  195. or when the image cannot be loaded. Tokens can be used.
  196. - Optionally, enter a value for the image 'title' attribute in the 'Title'
  197. textbox. The title is used as a tool tip when the user hovers the mouse
  198. over the image. Tokens can be used.
  199. 2. via URL:
  200. Create an image with the URL in following format:
  201. http://[your_domain]{/your_drupal_directory}/[path_to_public_files]/textimage/[style_name]/[Text_0]/[Text_1]/.../[Text_n].[extension]
  202. In a standard installation, [path_to_public_files] = 'sites/default/files'.
  203. Text_0...n - each string will be consumed by a textimage_text effect in the
  204. sequence specified within the image style.
  205. Note: This method can only be used by users with the 'generate textimage url
  206. derivatives' permission. This is to prevent Anonymous users from creating
  207. random images. If you need dynamically created Textimages, it is strongly
  208. advised you use one of the methods detailed below.
  209. 3. Programmers/themers - calling Textimage theme() functions:
  210. There are three theme functions that can be used to render HTML of Textimage
  211. images:
  212. -----------------------
  213. 'textimage_style_image'
  214. -----------------------
  215. This is used for Textimages based on a stored image style. Example:
  216. theme(
  217. 'textimage_style_image',
  218. array(
  219. 'style_name' => 'my_image_style',
  220. 'text' => array('text1', 'text2'),
  221. 'format' => 'png',
  222. 'alt' => 'Alternate text',
  223. 'title' => 'Image title',
  224. 'attributes' => array(),
  225. 'caching' => TRUE,
  226. 'node' => NULL,
  227. 'source_image_file' => NULL,
  228. ),
  229. ));
  230. Variables:
  231. - style_name - the image style name.
  232. - text - an array of text strings, with unresolved tokens; each string
  233. of the array will be consumed by a textimage_text effect in the sequence
  234. specified within the image style.
  235. - format - the file format of the resulting image (png/gif/jpg/jpeg).
  236. - alt - the image alternate text. This text will be used by screen readers,
  237. search engines, or when the image cannot be loaded. Tokens can be used.
  238. - title - the text to be displayed when hovering the image on the browser.
  239. Tokens can be used.
  240. - attributes - associative array of attributes to be placed in the img tag.
  241. - caching - if set to TRUE, the image will be cached for future accesses;
  242. otherwise, the image will be stored in textimage_store and deleted on
  243. cron run.
  244. - node - a node entity. It is used for resolving the tokens in the text
  245. effects.
  246. - source_image_file - a file entity. It is used for resolving the tokens
  247. in the text effects.
  248. ------------------------
  249. 'textimage_direct_image'
  250. ------------------------
  251. This is used for Textimages based on a image style created programmatically.
  252. Example:
  253. theme(
  254. 'textimage_direct_image',
  255. array(
  256. 'effects' => array(),
  257. 'text' => array('text1', 'text2'),
  258. 'format' => 'png',
  259. 'alt' => 'Alternate text',
  260. 'title' => 'Image title',
  261. 'attributes' => array(),
  262. 'caching' => TRUE,
  263. ),
  264. ));
  265. Variables:
  266. - effects - an array of image style effects. Given a $style image style
  267. array, corresponds to the $style['effects'] key. You can dynamically
  268. load and manipulate this array and pass it over to this theme, with no
  269. need to save it back to storage.
  270. - text - an array of text strings, with unresolved tokens; each string
  271. of the array will be consumed by a textimage_text effect in the sequence
  272. specified within the image style.
  273. - format - the file format of the resulting image (png/gif/jpg/jpeg).
  274. - alt - the image alternate text. This text will be used by screen readers,
  275. search engines, or when the image cannot be loaded. Tokens can be used.
  276. - title - the text to be displayed when hovering the image on the browser.
  277. Tokens can be used.
  278. - attributes - associative array of attributes to be placed in the img tag.
  279. - caching - if set to TRUE, the image will be cached for future accesses;
  280. otherwise, the image will be stored in textimage_store and deleted on
  281. cron run.
  282. ---------------------
  283. 'textimage_formatter'
  284. ---------------------
  285. This is the low level theme function used by Textimage to render HTML. It
  286. also allows to specify wrapping the tag in a container
    tag,
  287. and/or wrapping the entire output in an anchor tag.
  288. Variables:
  289. - textimage - A fully processed Textimage object. If this variable is set,
  290. the theme function will use this object to render the image, and the
  291. variables style_name, effects, text, format, caching, node,
  292. source_image_file, target_uri will be ineffective.
  293. - style_name - the image style name. If specified, it will override any
  294. value passed in the 'effects' variable.
  295. - effects - an array of image style effects. Given a $style image style
  296. array, corresponds to the $style['effects'] key.
  297. - text - an array of text strings, with unresolved tokens; each string
  298. of the array will be consumed by a textimage_text effect in the sequence
  299. specified within the image style.
  300. - format - the file format of the resulting image (png/gif/jpg/jpeg).
  301. - caching - if set to TRUE, the image will be cached for future accesses;
  302. otherwise, the image will be stored in textimage_store and deleted on
  303. cron run.
  304. - node - a node entity. It is used for resolving the tokens in the text
  305. effects.
  306. - source_image_file - a file entity. It is used for resolving the tokens
  307. in the text effects.
  308. - target_uri - allows to specify the URI where the textimage file should be
  309. stored. If specified, the automatic URI generation performed by Textimage
  310. is bypassed and caching disabled.
  311. - alt - the image alternate text. This text will be used by screen readers,
  312. search engines, or when the image cannot be loaded. Tokens can be used.
  313. - title - the text to be displayed when hovering the image on the browser.
  314. Tokens can be used.
  315. - attributes - associative array of attributes to be placed in the img tag.
  316. - image_container_attributes - if specified, the tag will be wrapped
  317. in a
    container, whose attributes will be set to the array passed
  318. here. Any attribute having the placeholder '#textimage_derivative_url#'
  319. will be resolved at run-time with the actual Textimage URL.
  320. - href - if specified, the entire output will be wrapped in a anchor,
  321. whose href will be set to the value passed here. If
  322. '#textimage_derivative_url#' is passed, the href will be resolved at
  323. run-time with the actual Textimage URL.
  324. 4. Programmers - calling API functions:
  325. Programmers can invoke directly TextimageImager::getImageUri() or
  326. TextimageImager::getImageUrl() to get respectively the URI or the full
  327. URL of a Textimage generated via the input parameters. Example:
  328. $my_textimage_uri = TextimageImager::getImageUri(
  329. $style_name,
  330. $effects_outline,
  331. $text,
  332. $extension,
  333. $caching,
  334. $node,
  335. $source_image_file,
  336. $target_uri
  337. );
  338. Variables:
  339. - $style_name - the image style name. If set to NULL, then
  340. $effects_outline is expected.
  341. - $effects_outline - a subset of an array of image style effects. Given
  342. a $style['effects'] array, corresponds to the array of 'name' and 'data'
  343. keys of each element. You can use the helper function
  344. TextimageStyles::getStyleEffectsOutline($style_name) to get this array
  345. based on a style name. If set to NULL then $style is expected.
  346. - $text - an array of text strings, with unresolved tokens; each string
  347. of the array will be consumed by a textimage_text effect in the sequence
  348. specified within the image style.
  349. - $extension - (optional) the file format of the resulting image
  350. (png/gif/jpg/jpeg). Defaults to 'png'.
  351. - $caching - (optional) if set to TRUE, the image will be cached for
  352. future access; otherwise, the image will be stored in
  353. textimage_store/uncached and deleted on cron run. Defaults to TRUE.
  354. - $node - (optional) a node entity. It is used for resolving the tokens
  355. in the text effects.
  356. - $source_image_file - (optional) a file entity. It is used for resolving
  357. the tokens in the text effects.
  358. - $target_uri - (optional) specifies the URI where the textimage file
  359. should be stored. Allows to bypass the automatic URI generation performed
  360. by Textimage. NOTE: It disables caching, as, given an URI, there is no
  361. control on the actual text that gets into the image.
  362. -------------------------------------------------------------------------------
  363. Using Textimage field formatters with tokens
  364. --------------------------------------------
  365. There are specific pre-conditions for text tokens to be resolved into full
  366. text. Some tokens are 'general' (e.g. current date and time, site name, etc.)
  367. but others require the 'context' that has to be accessed to retrieve
  368. information, like a user, or a node, etc. When the context is missing, the
  369. token can not be resolved.
  370. Textimage provides context for 'user', 'node' and 'file' tokens through
  371. its field display formatters. Textimage provides built-in field formatters
  372. for the following field types: 'image', 'text', 'text_with_summary',
  373. 'text_long'.
  374. If you select a Textimage formatter for a 'text' field, Textimage will use
  375. the text entered in the field to produce an image with it. In the field text
  376. you can enter the tokens directly, or [textimage:default] in which case
  377. Textimage will just fetch and use the default text entered in the image effect
  378. UI. If your image style is built with multiple 'Textimage text' effects, the
  379. text field needs to be multi-value as well. Each text field value will be used
  380. by one 'Textimage text' effect in the same sequence.
  381. Tokens will be resolved against the 'node' (current content) and 'user' token
  382. types.
  383. If you select a Textimage formatter for an 'image' field, Textimage will use
  384. the text entered in the default text in the image effect UI to produce the
  385. image. In this case, tokens will be resolved against 'node', 'user' and 'file'
  386. token types, where the 'file' is the original image uploaded in the content.
  387. Programmers can develop additional field display formatters, using the lower
  388. level APIs to pass 'node' or 'file' objects to be resolved. 'User' is always
  389. the current user within the scope of the Textimage image building process.
  390. -------------------------------------------------------------------------------
  391. Textimage tokens
  392. ----------------
  393. Textimage provides two tokens that can be used to retrieve the location where
  394. a Textimage image has been stored:
  395. A token to retrieve the URL of a Textimage image
  396. [textimage:url:field{:display}{:sequence}]
  397. and the URI equivalent
  398. [textimage:uri:field{:display}{:sequence}]
  399. where:
  400. - 'field' is the machine name of the field for which the Textimage is
  401. generated (e.g. 'body', or 'field_my_field');
  402. - 'display' is an optional indication of the display view mode (e.g. 'default',
  403. 'full', 'teaser', etc.); 'default' is used if not specified;
  404. - 'sequence' is an optional indication of the URL/URI to return if Textimage
  405. produces more images for the same field (like e.g. in a multi-value Image
  406. field); if not specified, a comma-delimited string of all the URLs/URIs
  407. generated will be returned.
  408. Textimage tokens can be used with the Metatag module to specify e.g. URL
  409. meta tags.
  410. -------------------------------------------------------------------------------
  411. Delta - 3.x vs. 2.x
  412. -------------------
  413. - Leverage Image and Tokens features that are embedded in core Drupal 7.
  414. - Drop the preset concept and db schema and use instead the Image concepts:
  415. styles and effects. This finally allows Textimage to use any image effect
  416. to build the final image - leveraging a wide library of image effects
  417. provided by core and other contrib modules. Also, it allows core Image
  418. module to use Textimage effects.
  419. - Move all primitive image functions to toolkit specific includes, allowing to
  420. potentially use alternative toolkits (other than GD).
  421. - Implement Drupal 7 field formatters for Text and Image fields.
  422. - Implement a derivative delivery mechanism specific to Textimage - enabling
  423. usage of scheme wrappers (public, private, ...) to indicate storage
  424. destination of image files, and providing a framework to leverage tokens.
  425. - Enable Tokens substitution at runtime in the text.
  426. - Implement a direct text to image theme (i.e. enable producing a textimage
  427. with no predefined style!).
  428. - Enhance the text overlay effects
  429. - Integrate with Imagecache Actions module to leverage its effects and
  430. functions (dependency).
  431. - Optional @font-your-face module integration for font management.
  432. - Optional Media module integration for background image management.
  433. - Optional jQuery Colorpicker module integration for color selection in
  434. effects' admin forms.
  435. - Documented API to produce Textimage images programmatically.
  436. - Textimage tokens to retrieve URI/URL of generated Textimage images.
  437. Wishlist
  438. --------
  439. - allow token resolution in theme_textimage_formatter href.
  440. - textimage_text effect - if elements with different opacity overlap (e.g.
  441. in case of shadow/outline or if background color is opaque itself), then
  442. we get a combined color effect. One may want to refer each element's
  443. opacity to the original image instead.
  444. - an ImageMagick toolkit implementation.