zikula-modules / Mediashare

Mediashare is a media file gallery designed for use with Zikula.
6 stars 1 forks source link

Plugin mediashare_mediaItem: handle alt attribute #59

Open hvorragend opened 13 years ago

hvorragend commented 13 years ago

At the moment the "alt" attribute of the img tag gets set automatically to the title. This prohibits different values for alt and title. Attachments

function.mediashare_mediaItem.php Download (2.8 KB) - added by Hraban 3 years ago. simple fix: check for "alt", set to title if unset

Change History comment:1 Changed 3 years ago by Hraban

The same fix is needed in pnmedia_imagegdapi.php:

function getMediaDisplayHtml($url, $width, $height, $id, $args) { if ((string)(int)$width == "$width") $width = "{$width}px"; $widthHtml = ($width == null ? '' : " width:{$width}"); $heightHtml = ($height == null ? '' : " height:$height"); $onclickHtml = (empty($args['onclick']) ? '' : " onclick=\"$args[onclick]\""); $classHtml = (empty($args['class']) ? '' : " class=\"$args[class]\""); $idHtml = ($id != '' ? " id=\"$id\"" : ''); $style = " style=\"$widthHtml$heightHtml\""; $title = (isset($args['title']) ? $args['title'] : ''); $alt = (isset($args['alt']) ? $args['alt'] : $title);

$html = "<img src=\"$url\"$style$idHtml title=\"$title\" alt=\"$alt\"$onclickHtml$classHtml/>";

if (isset($args['url']))
{
  $rel = (isset($args['urlRel']) ? " rel=\"$args[urlRel]\"" : '');
  $html = "<a href=\"$args[url]\"$rel>$html</a>";
}

return $html;

}

Changed 3 years ago by Hraban

attachment function.mediashare_mediaItem.php Download added

simple fix: check for "alt", set to title if unset