Opened 5 years ago

Last modified 3 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

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 Changed 5 years ago by Tomcraft

  • Milestone set to modified-shop-2.0.1.1
  • Type changed from Bug/Fehler to Erweiterung
  • Version set to 2.0.0.0

comment:2 Changed 5 years ago by web28

Hier steht einiges zum Thema alt und title Tags

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

comment:3 Changed 5 years ago by Tomcraft

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 5 years ago by Tomcraft (previous) (diff)

comment:4 Changed 4 years ago by Tomcraft

  • Milestone changed from modified-shop-2.0.2.0 to modified-shop-2.0.2.1

comment:5 Changed 4 years ago by Tomcraft

  • Milestone changed from modified-shop-2.0.2.1 to modified-shop-2.1.0.0

comment:6 Changed 4 years ago by Tomcraft

  • Milestone changed from modified-shop-2.1.0.0 to modified-shop-2.0.3.0

comment:7 Changed 3 years ago by Tomcraft

  • Milestone modified-shop-2.0.4.1 deleted

Add Comment

Modify Ticket

Action
as new
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.