Page MenuHomePhabricator

PageImages reports incorrect size of upscaled images
Closed, ResolvedPublic

Description

Unlike bitmap images, small SVG images are upscaled by PageImages to match the requested size, but the original size is reported, which is incorrect. This prevents Hovercards from displaying the image. For downscaled images, the size after downscaling is reported, which is correct.

Steps to reproduce:

  1. Let the image https://en.wikipedia.org/wiki/File:Strait.svg be a SVG with nominal size 166 × 188 px.
  2. Get https://en.wikipedia.org/w/api.php?action=query&format=xml&prop=pageimages&titles=Strait&pithumbsize=300
Expected result
<page _idx="58646" pageid="58646" ns="0" title="Strait" pageimage="Strait.svg">
  <thumbnail source="https://upload.wikimedia.org/wikipedia/commons/thumb/b/be/Strait.svg/265px-Strait.svg.png" width="265" height="300"/>
</page>
Actual result [BUG]
<page _idx="58646" pageid="58646" ns="0" title="Strait" pageimage="Strait.svg">
  <thumbnail source="https://upload.wikimedia.org/wikipedia/commons/thumb/b/be/Strait.svg/265px-Strait.svg.png" width="166" height="188"/>
</page>
  1. Get https://en.wikipedia.org/w/api.php?action=query&format=xml&prop=pageimages&titles=Strait&pithumbsize=100
Expected & Actual result [OK]
<page _idx="58646" pageid="58646" ns="0" title="Strait" pageimage="Strait.svg">
  <thumbnail source="https://upload.wikimedia.org/wikipedia/commons/thumb/b/be/Strait.svg/88px-Strait.svg.png" width="88" height="100"/>
</page>

Event Timeline

Change 273593 had a related patch set uploaded (by Petr.matas):
Thumbnails generated from SVG may be larger than original

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

Change 273593 merged by jenkins-bot:
Thumbnails generated from SVG may be larger than original

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