When an image is part of a View (in my case, a table) and made to link to a node, the alt and title text of the link are corrupted. For example, here is the output from one field:

<a href="/node/8" title="&amp;lt;img src=&amp;quot;/sites/default/files/image.jpg&amp;quot; alt=&amp;quot;&amp;quot; width=&amp;quot;90&amp;quot; height=&amp;quot;90&amp;quot; id=&amp;quot;imceimage-field_picture-0&amp;quot; /&amp;gt;" alt="&amp;lt;img src=&amp;quot;/sites/default/files/small_image.jpg&amp;quot; alt=&amp;quot;&amp;quot; width=&amp;quot;90&amp;quot; height=&amp;quot;90&amp;quot; id=&amp;quot;imceimage-field_picture-0&amp;quot; /&amp;gt;"><img src="/sites/default/files/small_image.jpg" alt="" width="90" height="90" id="imceimage-field_picture-0" /></a>

This might be a bug with Views, but I think it's more likely that IMCEImage is feeding it bad information or no information.

Comments

shashi_lo’s picture

This is what I did. Replace this line

$alt = strtr($alt, $tokens);

With this

$alt = ""

danepowell’s picture

I can't find the code that you're referring to - can you provide a patch? Are you sure that applies to 6.x-1.0-beta2?

danepowell’s picture

Project: Imce CCK Image » Views (for Drupal 7)
Version: 6.x-1.0-beta2 » 6.x-2.6

Ah, you failed to mention that you were talking about Views :) I suppose that would solve it. But I guess this is really a Views issue then. I'm not sure if it's exactly a duplicate or not. Here are the related issues that I found:

#496010: A wrong "alt" and "title" attributes in "a" tag for imagecache images: Pretty much a duplicate. Unfortunately merlinofchaos has already closed it as a duplicate of...
#489888: alt attribute set for node fields rendered as link produces not compliant HTML which has a patch that only half solves the problem (gets rid of alt attribute but leaves ugly title attribute). So I'm not sure if it's actually a duplicate or not.

You know, it looks like Views is blindly pulling the title attribute for links from whatever is contained in the links. Obviously a behavior that is intended to work with plain text links, but produces garbage for image links.

danepowell’s picture

Title: Alt and title text is corrupted in Views » Title attribute text is corrupted for image links

(updating the title to reflect what I think is the real problem, after dealing with the corrupt alt text)

dww’s picture

Status: Active » Fixed

This is probably now resolved thanks to #507884: Remove matching title attribute on node links. Please reopen if you try with the latest views code from HEAD and you're still seeing a problem.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.