Last updated May 28, 2010. Created on May 26, 2010.
Edited by EugenMayer. Log in to edit this page.

Api documentation

Documention of the API for


If you want to extend the image-detail form, e.g. adding new meta data like a description field or a node-reference and so forth, you can use a submodule. the hooks below cann be used to easily alter that form and implement new meta data. Just have a look at the lightbox integration submodule which covers nearly all usecases.

Often you only need

  1. hook_form_alter
  2. hook_wysiwyg_imageupload_entity_save

Thats pretty easy and should not take you more then 30 lines :)


theme_wysiwyg_imageupload_render_image_entity($img_obj, $arguments)

Theme the whole entity for viewing in a node

theme_wysiwyg_imageupload_render_image($img_obj, $arguments)

Theme the image itself for viewing in a node. It will be embeded into the container


Theme the meta-data which should be show on node-view. Title and so forth.


Theme the container with the rendered image and meta-data

theme_wysiwyg_imageupload_render_image_wysiwyg($img_obj, $arguments = array())

Here you can render the image for the WYSIWYG editor. Please dont change this until you exactly know what you do!!

Hooks and alter


After the node / comment has been created and the inline images have been "attached" (relation is has been build) you can finally react on this event with your code. E.g. convert the path to be private or whatever.


This hook is called when a new img_obj has been just inserted into the database, filled with all the details. You can alter those things, convert them or e.g. create a node for each image. The main difference to *_entity_attached is, that you dont have the relation yet, so you probably cant relate to the parent yet.


This hook is called when a new file has been just inserted into the database (uploaded). The file has not been assigend to an inline-entity ( iid ) yet, this will happen in hook_wysiwyg_imageupload_image_entity_created_alter. Its just the file.


You can alter the path for uploading a file using this hook. $path is already expanded to the current file directory + our relative upload root + user path (if present ). After this hook, the file gets uploaded.


You get passed the image rendered by theme_wysiwyg_imageupload_render_image and you can alter it. E.g. the lightbox integration is embedding it into a a-href


Change the attributes added to the image ( in the imagecache theme method ).

Looking for support? Visit the forums, or join #drupal-support in IRC.