Skip to content
This repository was archived by the owner on Aug 13, 2022. It is now read-only.
This repository was archived by the owner on Aug 13, 2022. It is now read-only.

Plugin mediashare_mediaItem: handle alt attribute #59

Description

@hvorragend

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions