Page MenuHomePhabricator

Images: Parsoid handling of format "frame" images with resizing option differs from PHP parser
Closed, ResolvedPublic

Description

Author: kyle.florence

Description:
Parsoid will render the following image with a 50 pixel width:
[[File:Example.jpg|frame|50px]]

Whereas the PHP parser would ignore the width entirely, as seen here: http://www.mediawiki.org/wiki/Help:Images


Version: unspecified
Severity: trivial

Details

Reference
bz53514

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:01 AM
bzimport added a project: Parsoid.
bzimport set Reference to bz53514.

Yes, the page states 'An image with _frame_ always ignores the size specification, the original image will be reduced if it exceeds the maximum size defined in user preferences.' Doesn't make much sense IMO, but we should mirror that behaviour.

Ed's citation is from https://www.mediawiki.org/wiki/Help:Images#Size_and_frame.

If there is a MediaWiki default value for the maximum size user pref then we should perhaps use that in Parsoid output. That will still keep our output independent of individual user's prefs, which is important.

The situation is complicated.

The spec given in https://www.mediawiki.org/wiki/Help:Images#Size_and_frame is not correct. The PHP parser code has grown bugs. The actual current behavior is:

  1. thumbs and frameless only reduce, never enlarge (the spec is correct here)
  2. frame images always render at their default size, *unless they have a height specified*, in which case they respect the specified height and ignore the width.
  3. There is user preference code for thumb size, but not for frame size --- the code is present but unreachable.
  4. It looks like there are some weird behaviors related to upright as well.

#2 and #3 appear to be bugs. I'm going to attempt to fix them first in core, then make parsoid match.

See bug 62258 for the issue in core.

Change 116983 had a related patch set uploaded by Cscott:
WIP: Match PHP parser behavior for image frame option.

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

Change 116983 merged by jenkins-bot:
Match PHP parser behavior for image frame option.

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