Forum:Categorizing uploaded content as Images, Videos and Files

If Special:PrefixIndex had a Display pages with suffix: companion to Display pages with prefix: then I would not even bother with these categories.

I like that when uploading files to wikia the Special:Upload interface provides a listbox presenting the various licenses (copyright notices) for a user to choose among. At the wiki I am working on right now I use those license templates to add all uploads into an Uploads category but I think I'd like for users to further categorize each uploaded file into one of 3 broad categories: (or possibly one of 5 specific categories)
 * 1) Images
 * 2) Videos
 * 3) Files
 * 4) * Audio files
 * 5) * OpenOffice.org files
 * 6) * ZIP files

Currently I must rely on a user to remember to use the albeit conveninent Category GUI after each file is uploaded. That is not too much to ask I know however, I wonder if it might be possible to customize the upload interface window to add 3 (or 5) radio buttons labeled per the above list or just another listbox if t ha tis not too confusing.

Even better
Better than asking the user to do this categorization I'd prefer for the filename extension to trigger categorization appropriately. viz.
 * Images:png, gif, jpg, jpeg, ico, xcf, svg,
 * Videos: ??? .. mmm ... I must not have that option enabled for the wiki in question
 * Audio files: ogg, mid,
 * PDF files: pdf,
 * OpenOffice.org files: odt, ods, odp, odg, odc, odf, odi, odm,
 * ZIP files: zip

Has anybody figured out an elegant way of encouraging the categorization of uploaded content? --najevi 05:33, November 8, 2009 (UTC)


 * Why would you categorize based on the extension? That doesn't make much sense, since there's really no way to trigger an auto-categorization there. If you want an auto-categorization, you should have a category included on all of your licensing templates. When the user selects a licensing template from the drop down menu or manually adds it to the summary box on Special:Upload, the category would be automatically added since it would be part of the template. That would mean rather than having categories like "Category:JPEG images," you'd have "Category:Fair use images," "Category:Screenshots," "Category:Promotional images," etc. to coincide with templates you can use such as,  ,  , etc., respectively. - Brandon Rhea  (talk) 07:27, November 8, 2009 (UTC)

It is not always clear whether or not a question is rhetorical. In case it was sincere then here is why: Now the problem with what you have proposed above is that the choice of license type is independent of the content type. Since one might have a dozen or more license types (the MediaWiki:Licenses that I use has no less than 16) and since I've just listed 6 content types above you can easily see how that can lead to far too numerous "license-content" categories to choose from. (Maybe not 16x6=96 but certainly some number north of 50.)
 * 1) As you know, the filename extension identifies what type of content the upload is. Therefore to browse the uploaded OpenOffice.org files, for example, it makes sense to search for files with one of the Open Document filename extensions.
 * 2) Indeed, I do make use of the license templates to attach just one category Category:Uploads to all uploaded content but I don't bother to use a category named after the license template chosen because I can simply use the Special:WhatLinksHere query with the name of any one of the license templates to obtain that set of file uploads.

I can think of nothing more intimidating than a list box with so many selections to choose from. Indeed it pains me to have the 16 that I already have.

I hope that brings clarity to the problem described. Sorting uploaded items by file type to locate something or just to browse is as intuitive to me as sorting files in a folder/directory by file type.

--najevi 14:08, November 8, 2009 (UTC)
 * It occurred to me while explaining this that, at SMW enabled wikis, it would be extremely useful if each File: namespace article was automatically annotated with a semantic property such as Filename_Extension. (With allowed values: png, gif, jpg, jpeg, ico, xcf, svg, ogg, mid, pdf, odt, ods, odp, odg, odc, odf, odi, odm, zip, etc.) Some simple SMW concepts can then be designed to create 6 (or more) "dynamic categories" based on what I asked for initially. This would do away with the need for actual categories.
 * I wonder if this might be possible via the code behind the Special:Upload and Special:MultipleUpload pages?


 * I really don't think any of this is feasibly possible. If you don't want to categorize them by image type, then add in new licensing templates such as to produce "Category:Fair use JPG images," or  to produce "Category:PNG screenshots." It'll take a little bit of work on your part and the part of your community to make these templates and recategorize all of the pre-existing images on the wiki, but it'd be a heck of a lot easier than asking the community team to make a large-scale coding change like this. The licensing templates are really the only realistic way of doing this. I'm sorry if it "pains you" to have a large list, but large lists are unavoidable, especially when you're dealing with United States copyright law when you absolutely have to do this sort of thing with images. Now categorizing based on extension is your choice, not copyright law, and the only realistic way of doing this is using templates, so if it pains you then you really only have two options: 1) use the templates with added extension categories anyway, or 2) don't do it at all and continue on not categorizing based on the extension. I don't know what else to tell you. - Brandon Rhea  (talk) 17:21, November 8, 2009 (UTC)
 * mw:Extension:CategoryOnUpload? --Michaeldsuarez (Talk) (Deeds) 18:42, November 8, 2009 (UTC)

Thank you, Michael. --najevi 19:45, November 8, 2009 (UTC)


 * I've used this extension before and it works pretty good, the downside however is the categories are defined in the wiki's settings (not a mediawiki page), and only Wikia can change those kinds of things. I'm pretty sure they can set it up for you, but having a finalized set of categories ready for them, rather than having to go and submit a special:contact request to have categories added, changed, or removed as needed. -- 19:49, November 8, 2009 (UTC)

It just occurred to me that I can annotate based on the page name because the page name contains the filename extension. A little bit of string manipulation and I ought to be able to bake this into each my 16 license templates. One I figure that out I'll post here again. --najevi 19:52, November 8, 2009 (UTC)

Solution for an SMW-enabled wiki
This solution involves including the following semantic annotation into each license template that is used at a wiki.

This is a property of type Has type::String. At the present time the allowed file types that may be uploaded to the are:
 * The "-1" conveniently grabs the last fragment of the exploded string so even if a filename uses mulitiple periods (.) the filename extension will always be returned. Note: lower case is forced ... just in case. (sic!)
 * In this case I have chosen a annotation (#set:) but the verbose alternative might just as easily been used.
 * The semantic property, Has extension, is defined as a string. Property:Has extension
 * Images:allows value::png, allows value::gif, allows value::jpg, allows value::jpeg, allows value::ico, allows value::xcf, allows value::svg
 * Videos: allows value::???not sure???
 * Audio files:allows value::ogg, allows value::mid
 * Portable Document Format (Adobe Reader) files:allows value::pdf
 * Open Document Format (OpenOffice.org) files:allows value::odt, allows value::ods, allows value::odp, allows value::odg, allows value::odc, allows value::odf, allows value::odi, allows value::odm
 * ZIP files:allows value::zip

This leaves it suitable for use in any semantic query and of course it can also be used in a semantic concept definition to very easily construct the "dynamic categories" that I was searching for.

The "dynamic category" of OOo files is then created as Concept:Open Document files defined as follows:

The "dynamic category" of Image files is then created as Concept:Image files defined as follows:

Uberfuzzy, This makes it easier to keep track of ZIP files at a wiki. Use the Concept:ZIP files:

By using File:+ in each concept query it draws upon all pages in the File: namespace. I may need to tweak the above to allow for the (albeit small) possibility of sub-pages being drawn into the query net but I am fairly sure that having enumerated the allowed values for Has extension adequately guards against such problems.

This is even more elegant than traditional category method.

-- najevi 21:38, November 8, 2009 (UTC)