[Mediawiki-l] Image folders

Daniel Friesen lists at nadir-seen-fire.com
Mon Apr 18 16:37:00 UTC 2011

On 11-04-18 09:23 AM, Juan Rodríguez wrote:
> Hi folk,
> I studing wikimedia system and there is something I want to know about
> images:
> Is it possible to upload (and so on store) the images in different folders?
> I realised that when you do a normal upload, files are stored in folders
> with *arbitrary?* name like: "A", "01", etc. Does anybody know what
> programming mechanism is used to allow this? Could it be used to upload
> files to different folders?
> Thanks.
That's the $wgHashedUploadDirectory setting (on by default) which is
used to avoid having too many files in one folder because some
filesystems don't perform well with large numbers of files in one folder.

The algorithm for that is based on a md5 of the name, the first hex
character is used for the first directory, then the first two characters
are used for the subdirectory.
Foo.png -> md5 = f865cbca12286c1c5b7616b4a70fbf68 -> f + f8 = /f/f8/Foo.png

~Daniel Friesen (Dantman, Nadir-Seen-Fire) [http://daniel.friesen.name]

More information about the MediaWiki-l mailing list