Full ELMS Learning Network documentation
function theme_image
×
Error message
User warning: The following module is missing from the file system: theme/theme. For information about how to fix this, see the documentation page. in _drupal_trigger_error_with_delayed_logging() (line 1156 of /var/www/html/elmsln_community/api.elmsln.org/includes/bootstrap.inc).cis7 theme.inc | theme_image($variables) |
cle7 theme.inc | theme_image($variables) |
elmsmedia7 theme.inc | theme_image($variables) |
icor7 theme.inc | theme_image($variables) |
meedjum_blog7 theme.inc | theme_image($variables) |
mooc7 theme.inc | theme_image($variables) |
Returns HTML for an image.
Parameters
$variables: An associative array containing:
- path: Either the path of the image file (relative to base_path()) or a full URL.
- width: The width of the image (if known).
- height: The height of the image (if known).
- alt: The alternative text for text-based browsers. HTML 4 and XHTML 1.0 always require an alt attribute. The HTML 5 draft allows the alt attribute to be omitted in some cases. Therefore, this variable defaults to an empty string, but can be set to NULL for the attribute to be omitted. Usually, neither omission nor an empty string satisfies accessibility requirements, so it is strongly encouraged for code calling theme('image') to pass a meaningful value for this variable.
- title: The title text is displayed when the image is hovered in some popular browsers.
- attributes: Associative array of attributes to be placed in the img tag.
Related topics
29 theme calls to theme_image()
- adaptivetheme_preprocess_page in sites/
all/ themes/ ulmus/ adaptivetheme/ at_core/ inc/ preprocess.inc - Preprocess variables for page.tpl.php
- corolla_tablesort_indicator in sites/
all/ themes/ ulmus/ corolla/ template.php - Returns HTML for a sort icon.
- ctools_ajax_image_button in sites/
all/ modules/ ulmus/ ctools/ includes/ ajax.inc - Render an image as a button link. This will automatically apply an AJAX class to the link and add the appropriate javascript to make this happen.
- ctools_ajax_sample_page in sites/
all/ modules/ ulmus/ ctools/ ctools_ajax_sample/ ctools_ajax_sample.module - Page callback to display links and render a container for AJAX stuff.
- ctools_modal_add_js in sites/
all/ modules/ ulmus/ ctools/ includes/ modal.inc
180 string references to the theme hook from theme_image()
Note: this list is generated by looking for the string for this theme hook, so it may include some references that are not actually using this theme hook.
- adaptivetheme_preprocess_field in sites/
all/ themes/ ulmus/ adaptivetheme/ at_core/ inc/ preprocess.inc - Preprocess variables for field.tpl.php
- adaptivetheme_preprocess_page in sites/
all/ themes/ ulmus/ adaptivetheme/ at_core/ inc/ preprocess.inc - Preprocess variables for page.tpl.php
- aggregator_element_data in modules/
aggregator/ aggregator.parser.inc - Performs an action when data is encountered.
- aggregator_element_end in modules/
aggregator/ aggregator.parser.inc - Performs an action when a closing tag is encountered.
- aggregator_element_start in modules/
aggregator/ aggregator.parser.inc - Performs an action when an opening tag is encountered.
File
- includes/
theme.inc, line 1784 - The theme system, which controls the output of Drupal.
Code
function theme_image($variables) {
$attributes = $variables['attributes'];
$attributes['src'] = file_create_url($variables['path']);
foreach (array('width', 'height', 'alt', 'title') as $key) {
if (isset($variables[$key])) {
$attributes[$key] = $variables[$key];
}
}
return '<img' . drupal_attributes($attributes) . ' />';
}