File namespace specific magic words
Open, NormalPublic

Description

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.


Version: unspecified
Severity: enhancement

Details

Reference
bz36523
bzimport set Reference to bz36523.
bzimport added a subscriber: Unknown Object (MLST).

See also bug 30282, specifically bug 30282 comment 2.

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.

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

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.

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.

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.

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.

Jdforrester-WMF moved this task from Untriaged to Backlog on the Multimedia board.Sep 4 2015, 6:34 PM
Restricted Application added subscribers: Steinsplitter, Matanya, Aklapper. · View Herald TranscriptSep 4 2015, 6:34 PM

Add Comment