Page MenuHomePhabricator

VE should respect the size set by the thumbnail rather than the intrinsic size
Closed, ResolvedPublic

Description

In visual editing mode, VE does not respect the width and height attribute on the image set by the image wikitext syntax. Instead, it ignores the attributes and uses the intrinsic size of the image. Often times it is a thumbnail so it is not an issue. However, when the wiki doesn't have proper thumbnails or using an extension like NativeSvgHandler, the images are not sized properly.

Event Timeline

It should be respecting them. Can you provide more detailed instructions on how to reproduce this problem?

It should be respecting them. Can you provide more detailed instructions on how to reproduce this problem?

It is mainly an issue with Extension:NativeSvgHandler, I am not sure if other media handler has the same issue as well.
With NativeSvgHandler in Visual Edit mode, the SVGs are rendered in their intrinsic size rather than the size defined in the width and height attributes in the HTML. I am unsure about how VE parses the size of the images, so I suspect that it is ignoring the size attributes, as normally the source images are already processed into a specific size on the wiki page.

alistair3149 claimed this task.

The issue stemmed from how NativeSvgHandler build the thumbnail originally. It is mitigated in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/NativeSvgHandler/+/699969