I have a custom module that outputs some images. Now, I would like to render them properly.
echo theme('image_style', array( 'path' => $image['uri'], 'style_name' => 'product_page_thumbnail', 'attributes' => array( 'alt' => $image['ImageAlt'], 'title' => $image['ImageTitle'], ) ));
theme() docs says:
Avoid calling this function directly. It is preferable to replace direct calls to the
theme()function with calls to
drupal_render()by passing a render array with a #theme key to
drupal_render(), which in turn calls
So how would I do that?
I know renderable array for links, it's as simple as:
$link = array( '#type' => 'link', '#title' => $title, '#href' => 'http://example.com', '#options' => array('html' => TRUE, 'title' => 'link'), );
So I want the same, but for images. Somehow I can't find any documented example of it.
1Internal Stack Exchange links, just for reference.