https://bugzilla.wikimedia.org/show_bug.cgi?id=26548
--- Comment #8 from Bawolff <[email protected]> 2011-01-30 04:24:52 UTC --- Created attachment 8065 --> https://bugzilla.wikimedia.org/attachment.cgi?id=8065 possible patch to make instantcommons work with paged media Here's a first version of a patch to make this work. The basic issue is: *When transforming a file into a thumbnail, there are several parameters. The most basic are width and height. Paged media (like pdf's) also use a page parameter. Media handlers can define whatever parameters are useful to them (for example, oggHandler uses a seek parameter to determine which frame in a video stream to use as a thumbnail). *The API only supports making thumbnails with the width and height parameters. No other parameters are supported. *ForeignApiFile throws away any other rendering parameters that aren't width or height. This patch fixes that by adding a new parameter to the api - iiurlparam. This should fix the issue. However there's a couple things I'm not sure about (which is why this is attached to the bug instead of committed). *The syntax for specifying rendering parameters to the api is api.php?titles=file:your_image.pdf&action=query&query=imageinfo&prop=url&iiurlwidth=200&iiurlparam=page=3|some_other_parameter=bar Basically, iiurlparam takes a | separated list of name=value pairs. Having name=value inside an api parameter is a little different from how the rest of the api works. However we can't just have iiurl<param name here> because the parameters could be anything. Although we could just have iiurlpage since that is really the only one causing the issues at the mto be consistentoment, but that seems kind of half-hearted. *Does allowing arbitrary rendering parameters introduce any security issues? I'm pretty sure it does not, since I believe they are validated before used, however not 100% sure how the image rendering code actually works. Just from giving useful error messages, the parameters should probably be validated inside ApiQueryImageInfo better then what I've done (as it stands, if something is really invalid, it should cause a mediatransformerror, which seems to just cause the api not to output a thumb parameter, with no warnings/errors. Maybe pass through the image handler's normaliseParams before trying to use, and error out if that returns false). *A minor issue. I'm not sure what the deal is with the error codes in this module. http://en.wikipedia.org/w/api.php?action=query&prop=imageinfo&titles=image:Example.jpg&iiprop=url&iiurlheight=10&format=xml has a couple too many i's. So do the new error codes I introduced (to be consistent, since i'm not really sure what the conventions with api error codes actually are). So anyways, thoughts? -- Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. _______________________________________________ Wikibugs-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikibugs-l
