MediaWiki Image Paths

MediaWiki does some nifty file path obfuscation (I should try and see if the iPod does something similar because it’s the main reason I switched to running Rockbox on it). I’ve been working on a hover feature for articles featuring icons linked to wiki articles. Maybe it was obvious to others but it took me a bit of digging to find how to determine the hashed directory structure especially since it could be any number of techniques to accomplish this. Here is my snippet from my wiki grabber class:

$hashedFileName = md5($skillName.'.jpg');
$icon = '<img src="'.$this->baseWikiUrl.'images/'.
substr($hashedFileName, 0, 1).'/'.
substr($hashedFileName, 0, 2).'/'.
urlencode($skillName).'.jpg" />';

What a rabbit trail! That’s how you can recreate the path since its based on the file name.

This entry was posted in Uncategorized. Bookmark the permalink.

Comments are closed.