theme_image

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

includes/theme.inc, строка 616

Версии
5 – 6
theme_image($path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE)

Возвращает темизированную картинку.

Параметры

$path Путь к файлу изображения (относительно base_path()) или полный URL.

$alt Альтернативный текст для текстовых браузеров (атрибут alt).

$title Название, которое показывается при наведении на изображение в некоторых популярных браузерах (атрибут title).

$attributes Ассоциативный массив атрибутов помещаемых в тэг <img>.

$getsize Если TRUE, в тэг добавятся атрибуты width/height с размером изображения.

Возвращаемое значение

Строка, содержащая HTML код изображения.

Связанные темы

▾ 10 функции вызывают theme_image()

color_form_alter in modules/color/color.module
Реализация hook_form_alter().
system_themes in modules/system/system.module
Menu callback; displays a listing of all themes.
system_theme_select_form in modules/system/system.module
Returns a fieldset containing the theme select form.
theme_aggregator_block_item in modules/aggregator/aggregator.module
Format an individual feed item for display in the block.
theme_feed_icon in includes/theme.inc
Возвращает код, который выдает иконку новостной ленты.
theme_forum_icon in modules/forum/forum.module
Format the icon for each individual topic.
theme_tablesort_indicator in includes/theme.inc
Return a themed sort icon.
theme_user_picture in modules/user/user.module
theme_xml_icon in includes/theme.inc
Возвращает код, который отображает иконку XML.
watchdog_overview in modules/watchdog/watchdog.module
Menu callback; displays a listing of log messages.

Код

<?php
function theme_image($path, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE) {
  if (!$getsize || (is_file($path) && (list($width, $height, $type, $image_attributes) = @getimagesize($path)))) {
    $attributes = drupal_attributes($attributes);
    $url = (url($path) == $path) ? $path : (base_path() . $path);
    return '<img src="'. check_url($url) .'" alt="'. check_plain($alt) .'" title="'. check_plain($title) .'" '. $image_attributes . $attributes .' />';
  }
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему