Page MenuHomePhabricator

Missing images render as broken img tags, not redlinks
Closed, ResolvedPublic

Description

PHP:

image.png (62×208 px, 3 KB)

Parsoid:
image.png (343×326 px, 5 KB)

With PHP it is clear we have created a "red link" and not just that the image failed to load due to some intermittent network failure.

The counterpoint is that as a document model, the Parsoid version is much more consistent. If we removed the <img> tag we'd need to put alt, link and dimensions somewhere else, and clients would need to be updated (although VE already special-cases mw:Error images to make our CE rendering look more like the PHP output)

Related Objects

StatusSubtypeAssignedTask
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
OpenNone
DeclinedNone
ResolvedCatrope
ResolvedSbailey
Resolved GWicke
ResolvedNone
Resolvedssastry
ResolvedArlolra
ResolvedDbrant
Resolved bearND
ResolvedMholloway
ResolvedNone
DuplicateNone
ResolvedJdforrester-WMF
Resolved bearND
OpenNone
ResolvedArlolra
ResolvedArlolra

Event Timeline

Discussed today at parsing-team meeting.

Some examples of PHP output for broken images with explicit link attributes at https://en.wikipedia.org/wiki/User:Cscott/Sandbox

Note that the link= attribute for the broken image gets ignored & replaced with a link to Special:Upload for a broken image:

There's some social aspects of the PHP design here, in particular the ability for readers to click through a redlink to fix it (in the same way that article redlinks work).

Two options were discussed.

Option "Stuff a span":

  1. replace <img> with <span>File:....</span>, preserving the overall tree structure of image markup for consistency.

2a) hoist any wikitext link attribute into data-mw for roundtripping
2b) alternatively, hoist the wikitext link property into a new origHref attribute (bikeshedding name welcome)

  1. replace href attribute of <a> tag with a direct link to [[special:upload]] for PHP compat (and social compatibility)
  2. leave the mw:Error in the typeof

Option "Use a non-broken image"

  1. Add filename as an alt attribute to the image, add a class to the a-tag, and change the img src to point to a real non-broken image (maybe [[Special:BrokenImage.png]] or something like that)

2a/2b, 3, 4) as above

Arlolra triaged this task as Medium priority.

Ancient%20Order%20of%20Froth%20Blowers.diff.png (1×1 px, 864 KB)

This is an issue for the implementation of T118517 in https://gerrit.wikimedia.org/r/#/c/196532/ since the dimensions are only on the image which, as the task describes, is absent in the current php rendering.

Change 463125 had a related patch set uploaded (by Arlolra; owner: Arlolra):
[mediawiki/services/parsoid@master] [WIP] Add media info in a post-processing pass

https://gerrit.wikimedia.org/r/463125

Change 463125 merged by jenkins-bot:
[mediawiki/services/parsoid@master] Add media info in a post-processing pass

https://gerrit.wikimedia.org/r/463125