File namespace specific magic words
OpenPublic

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

bzimport added a subscriber: wikibugs-l.
bzimport set Reference to bz36523.
ToAruShiroiNeko created this task.Via LegacyMay 4 2012, 7:48 PM
Bawolff added a comment.Via ConduitMay 4 2012, 8:01 PM

See also bug 30282, specifically bug 30282 comment 2.

ToAruShiroiNeko added a comment.Via ConduitMay 4 2012, 10:12 PM

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.

Petrb added a comment.Via ConduitMay 14 2012, 11:18 AM

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

ToAruShiroiNeko added a comment.Via ConduitMay 14 2012, 11:22 AM

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.

Petrb added a comment.Via ConduitMay 14 2012, 11:32 AM

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.

ToAruShiroiNeko added a comment.Via ConduitMay 14 2012, 4:58 PM

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.

brion added a comment.Via ConduitMay 24 2012, 10:30 PM

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.

Gilles added a project: Multimedia.Via WebNov 24 2014, 3:38 PM

Add Comment