You are here

function theme_ad_image_image in Advertisement 6.3

Same name and namespace in other branches
  1. 6 image/ad_image.module \theme_ad_image_image()
  2. 6.2 image/ad_image.module \theme_ad_image_image()
  3. 7 image/ad_image.module \theme_ad_image_image()

Return a themed ad image.

Parameters

$path: Either the path of the ad image file (relative to base_path()) or a full URL.

$alt: The alternative text for text-based browsers.

$tooltip: The tooltip text is displayed when the image is hovered in some popular browsers.

$attributes: Associative array of attributes to be placed in the img tag.

$getsize: If set to TRUE, the image's dimension are fetched and added as width/height attributes.

Return value

A string containing the image tag.

1 theme call to theme_ad_image_image()
theme_ad_image_ad in image/ad_image.module
Return a themed ad of type ad_image.

File

image/ad_image.module, line 60
Enhances the ad module to support banner ads.

Code

function theme_ad_image_image($path, $alt = '', $tooltip = '', $attributes = NULL, $getsize = TRUE) {
  if ($getsize) {
    list($width, $height, $type, $image_attributes) = @getimagesize($path);
    if (isset($width) && isset($height)) {
      $attributes = drupal_attributes($attributes);
      if (is_file($path)) {
        $url = preg_replace('&' . drupal_get_path('module', 'ad') . '/&', '', file_create_url($path));
      }
      else {
        $url = $path;
      }
      return '<img src="' . check_url($url) . '" alt="' . check_plain($alt) . '" title="' . check_plain($tooltip) . '" ' . $image_attributes . $attributes . ' />';
    }
  }
}