Changes between Initial Version and Version 1 of Ticket #1052, comment 3


Ignore:
Timestamp:
Oct 19, 2016, 1:11:38 PM (9 years ago)
Author:
Torsten Riemer

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #1052, comment 3

    initial v1  
    1 Dann sollten wir die Lösung so übernehmen.
     1Aus dem Text:
     2{{{
     3[...]
     4Das Title-Attribute sollte dafür genutzt werden, dem mit einer Mouse über ein Bild fahrenden Besucher anzuzeigen, was ggf. passiert, wenn er/sie auf das Bild klickt. Das Title-Attribute kann z.B. title=“Bild vergrößern“ oder „Öffnet in einem neuen Fenster“ lauten.
     5[...]
     6}}}
     7
     8Das title & alt nicht den gleichen Inhalt haben sollen, muss man die komplette Funktion ändern und um $title erweitern:
     9
     10{{{
     11  function xtc_image($src, $alt = '', $width = '', $height = '', $parameters = '', $title = '') {
     12    if ( (empty($src) || ($src == DIR_WS_IMAGES) || ( $src == DIR_WS_THUMBNAIL_IMAGES))) {
     13      return false;
     14    }
     15
     16    // alt is added to the img tag even if it is null to prevent browsers from outputting
     17    // the image filename as default
     18    $image = '<img src="' . xtc_parse_input_field_data(DIR_WS_BASE.$src, array('"' => '&quot;')) . '"' . (!empty($title) ? (' title="' . xtc_parse_input_field_data($title, array('"' => '&quot;')) . '"') : '') . ' alt="' . xtc_parse_input_field_data($alt, array('"' => '&quot;')) . '"';
     19    if (defined('CONFIG_CALCULATE_IMAGE_SIZE') && CONFIG_CALCULATE_IMAGE_SIZE == 'true' && (empty($width) || empty($height)) && is_file($src)) {
     20      if ($image_size = @getimagesize($src)) {
     21        if (empty($width) && xtc_not_null($height)) {
     22          $ratio = $height / $image_size[1];
     23          $width = (int)($image_size[0] * $ratio);
     24        } elseif (xtc_not_null($width) && empty($height)) {
     25          $ratio = $width / $image_size[0];
     26          $height = (int)($image_size[1] * $ratio);
     27        } elseif (empty($width) && empty($height)) {
     28          $width = $image_size[0];
     29          $height = $image_size[1];
     30        }
     31      } elseif (defined('IMAGE_REQUIRED') && IMAGE_REQUIRED == 'false') { //DokuMan - 2010-02-26 - set undefined constant
     32        return false;
     33      }
     34    }
     35
     36    if (xtc_not_null($width) && xtc_not_null($height)) {
     37      $image .= ' width="' . xtc_parse_input_field_data($width, array('"' => '&quot;')) . '" height="' . xtc_parse_input_field_data($height, array('"' => '&quot;')) . '"';
     38    }
     39
     40    if (xtc_not_null($parameters)) $image .= ' ' . $parameters;
     41
     42    $image .= ' />';
     43    return $image;
     44  }
     45}}}