Last modified: 2014-04-14 14:36:56 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T27989, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 25989 - Image scaling given only the height does not seem to work
Image scaling given only the height does not seem to work
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.16.x
All All
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
https://www.mediawiki.org/wiki/Reques...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-11-18 12:15 UTC by Gabriel Sandor
Modified: 2014-04-14 14:36 UTC (History)
8 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Gabriel Sandor 2010-11-18 12:15:50 UTC
The API does not seem to allow any way to retrieve a thumb url for an image given only its height and no width specified.
For instance, accessing the following URL: http://en.wikipedia.org/w/api.php?action=query&format=xml&titles=File:Flag+of+Spain.svg&prop=imageinfo&iiprop=dimensions|url&iiurlheight=28

gives the following XML response:

<api>
<error code="iiiiurlwidth" info="iiurlheight cannot be used without iiurlwidth"/>
</api>

How, therefore, could one retrieve a thumb url for an image given the height to scale to, without specifying the width ? An example of such a situation would be when parsing the following snippet of wikitext:
[[Image:Flag of Spain.svg |x28px]] - here only the height is specified, thus an image of the flag of Spain should be retrieved having the height set to 28 pixels and the width scaled accordingly.
Comment 1 Gabriel Sandor 2010-11-18 12:23:40 UTC
It seems that there's a workaround by providing the iiurlwidth param. with large values, surpassing the native width for the requested file - at least for some svg files, not sure if applicable also to other types of images.
Comment 2 Bryan Tong Minh 2010-11-23 20:33:34 UTC
This was more complicated than I thought. Apparently the "x28px" case is undefined (but useful) behaviour: Parser::makeImage only sets the height parameter, which causes the linker to set the width parameter to the image source width, which will then cause MediaHandler::normaliseParameters to set the width to the width corresponding to height...

This needs to be handled in the file/media/parser code in a defined way before we can implement this in the API. If the described behaviour is useful (which I think it is), also a parser test should be written.
Comment 3 Nemo 2012-10-25 07:51:58 UTC
Possible duplicate: bug 24763.
Somehow related: bug 32387.
Comment 4 Nemo 2014-03-27 16:42:40 UTC
(In reply to Nemo from comment #3)
> Possible duplicate: bug 24763.
> Somehow related: bug 32387.

And Scott made an RfC which seems to be exactly about this bug: <https://www.mediawiki.org/wiki/Requests_for_comment/Square_bounding_boxes>. Isn't it?
Comment 5 Bawolff (Brian Wolff) 2014-03-27 17:18:29 UTC
Umm. The url in comment 0 seems to work.
Comment 6 C. Scott Ananian 2014-04-14 14:36:56 UTC
Closing as fixed; I've verified that the URL in comment 0 now works (as bawolff mentions).

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links