Last modified: 2012-05-24 22:30:41 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 T38523, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 36523 - File namespace specific magic words
File namespace specific magic words
Status: NEW
Product: MediaWiki
Classification: Unclassified
File management (Other open bugs)
unspecified
All All
: Normal enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-04 19:48 UTC by とある白い猫
Modified: 2012-05-24 22:30 UTC (History)
4 users (show)

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


Attachments

Description とある白い猫 2012-05-04 19:48:05 UTC
Magic words such as {{FILEWIDTH}}, {{FILEHEIGHT}}, {{FILESIZE}}, {{FILEEXTENSION}} would be helpful to me. I want to categorize files on commons based on these values.

For example, I want to be able to be able to determine if an images resolution (height x width) is within a certain threshold. Likewise I want to be able to determine if the image is widescreen or not.

I would also like to check the filesize is reasonable so that it isn't too large or perhaps too small.

I also want to know the file extension so as to be able to eliminate file-types such as "pdf", "svg", "ogg", "ogv" and etc when trying to compile a list of files that may be worthy for desktop backgrounds.

I could achieve all of these and more if I had such magic words. The information I seek is present on file description pages already though I am unsure how those are generated.
Comment 1 Bawolff (Brian Wolff) 2012-05-04 20:01:45 UTC
See also bug 30282, specifically bug 30282 comment 2.
Comment 2 とある白い猫 2012-05-04 22:12:55 UTC
These aren't for the thumbnails though. I am trying to acquire the original file max resolution.

Extension:MediaFunctions perhaps does what I need but does a lot more than I need. It also fails to return the file extension.
Comment 3 Peter Bena 2012-05-14 11:18:16 UTC
probably there could be a bit more tags, is FILEEXTENSION really useful? I think that FILETYPE EXTINFO would be more usefull, extension is clear from name
Comment 4 とある白い猫 2012-05-14 11:22:31 UTC
I want to be able to distinguish svgs from pngss without effort. It would be helpful particularly when reviewing files in bulk.

For instance I would want to categorize svg, ogg, ogv, oga, pdf files separately under some conditions. This is for template use primarily.

I am unsure how to use FILETYPE EXTINFO in templates to be honest.
Comment 5 Peter Bena 2012-05-14 11:32:59 UTC
FILETYPE would probably return a file type, just like unix command file does, that means "svg, png etc..." it's MS-DOS which brought file extensions and not really a standard for all kinds of files, although all images have some extension. So in this case it would make sense to use extension in order to find out which kind of file it is.
Comment 6 とある白い猫 2012-05-14 16:58:09 UTC
It could simply be a parse of the last "." and text after that would be returned. It may be helpful if that was all in lowercase to ease implementation.
Comment 7 Brion Vibber 2012-05-24 22:30:41 UTC
I think the way to go with this is to extend the small FileInfo extension that I wrote a while ago: <https://www.mediawiki.org/wiki/Extension:FileInfo> <http://svn.wikimedia.org/viewvc/mediawiki/trunk/extensions/FileInfo/>

This currently has a parser function for getting the size of an arbitrary file; you can use {{#filesize:{{PAGENAME}}}} etc to do the equivalent of just a raw magic word, with the benefit that you can use it in templates and things.

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


Navigation
Links