Modify

Opened 9 years ago

Last modified 8 years ago

#1052 new Erweiterung

Fehlender Title-Tag bei Bildern

Reported by: matzell Owned by: somebody
Priority: normal Milestone:
Component: Shop Version: 2.0.0.0
Keywords: Cc:
Blocked By: Blocking:

Description

Datei: /inc/xtc_image.inc.php
Zeile: 30

Bisher:

    $image = '<img src="' . xtc_parse_input_field_data(DIR_WS_BASE.$src, array('"' => '&quot;')) . '" alt="' . xtc_parse_input_field_data($alt, array('"' => '&quot;')) . '"';

Ändern zu:

    $image = '<img src="' . xtc_parse_input_field_data(DIR_WS_BASE.$src, array('"' => '&quot;')) . '" title="' . xtc_parse_input_field_data($alt, array('"' => '&quot;')) . '" alt="' . xtc_parse_input_field_data($alt, array('"' => '&quot;')) . '"';

Grund:
Durch das fehlen des Title-Tags kann z.B. dem Slider kein Caption hinzugefügt werden. Zudem ist es ratsam, dass ein jedes Bild IMMER mit einem Title versehen ist.

Attachments (0)

Change History (7)

comment:1 by Torsten Riemer, 9 years ago

Milestone: modified-shop-2.0.1.1
Type: Bug/FehlerErweiterung
Version: 2.0.0.0

comment:2 by Ronald Parcinski, 9 years ago

Hier steht einiges zum Thema alt und title Tags

https://www.seo-united.de/blog/seo/alt-und-title-attribute-bilder.htm

comment:3 by Torsten Riemer, 9 years ago

Aus dem Text:

[...]
Das 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.
[...]

Das title & alt nicht den gleichen Inhalt haben sollen, muss man die komplette Funktion ändern und um $title erweitern:

  function xtc_image($src, $alt = '', $width = '', $height = '', $parameters = '', $title = '') {
    if ( (empty($src) || ($src == DIR_WS_IMAGES) || ( $src == DIR_WS_THUMBNAIL_IMAGES))) {
      return false;
    }

    // alt is added to the img tag even if it is null to prevent browsers from outputting
    // the image filename as default
    $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;')) . '"';
    if (defined('CONFIG_CALCULATE_IMAGE_SIZE') && CONFIG_CALCULATE_IMAGE_SIZE == 'true' && (empty($width) || empty($height)) && is_file($src)) {
      if ($image_size = @getimagesize($src)) {
        if (empty($width) && xtc_not_null($height)) {
          $ratio = $height / $image_size[1];
          $width = (int)($image_size[0] * $ratio);
        } elseif (xtc_not_null($width) && empty($height)) {
          $ratio = $width / $image_size[0];
          $height = (int)($image_size[1] * $ratio);
        } elseif (empty($width) && empty($height)) {
          $width = $image_size[0];
          $height = $image_size[1];
        }
      } elseif (defined('IMAGE_REQUIRED') && IMAGE_REQUIRED == 'false') { //DokuMan - 2010-02-26 - set undefined constant
        return false;
      }
    }

    if (xtc_not_null($width) && xtc_not_null($height)) {
      $image .= ' width="' . xtc_parse_input_field_data($width, array('"' => '&quot;')) . '" height="' . xtc_parse_input_field_data($height, array('"' => '&quot;')) . '"';
    }

    if (xtc_not_null($parameters)) $image .= ' ' . $parameters;

    $image .= ' />';
    return $image;
  }
Last edited 9 years ago by Torsten Riemer (previous) (diff)

comment:4 by Torsten Riemer, 9 years ago

Milestone: modified-shop-2.0.2.0modified-shop-2.0.2.1

comment:5 by Torsten Riemer, 9 years ago

Milestone: modified-shop-2.0.2.1modified-shop-2.1.0.0

comment:6 by Torsten Riemer, 9 years ago

Milestone: modified-shop-2.1.0.0modified-shop-2.0.3.0

comment:7 by Torsten Riemer, 8 years ago

Milestone: modified-shop-2.0.4.1

Modify Ticket

Action
as new The owner will remain somebody.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.