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

Restricted Application added subscribers: StudiesWorld, Aklapper. · View Herald TranscriptFeb 27 2016, 3:03 PM
petr.matas added a subscriber: MaxSem.EditedFeb 27 2016, 5:20 PM

Apparently the bug was introduced by rEPIM195615137e99 (https://gerrit.wikimedia.org/r/139276/).

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

petr.matas updated the task description. (Show Details)Feb 27 2016, 8:12 PM
bd808 triaged this task as Normal priority.Feb 29 2016, 5:56 PM

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

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

petr.matas closed this task as Resolved.Mar 2 2016, 9:09 PM
petr.matas removed a project: Patch-For-Review.