function wfSajaxGetImageUrl($term)
{
    global $wgExtensionFunctions, $wgTitle;
    $options = new CKeditorParserOptions();
    $options->setTidy(true);
    $parser = new CKeditorParser();
    if (in_array('wfCite', $wgExtensionFunctions)) {
        $parser->setHook('ref', array($parser, 'ref'));
        $parser->setHook('references', array($parser, 'references'));
    }
    $parser->setOutputType(OT_HTML);
    $originalLink = $parser->parse('[[File:' . $term . ']]', $wgTitle, $options)->getText();
    if (false == strpos($originalLink, 'src="')) {
        return '';
    }
    $srcPart = substr($originalLink, strpos($originalLink, "src=") + 5);
    $url = strtok($srcPart, '"');
    if (substr($url, -strlen($term)) == $term) {
        return $url;
    }
    return "";
}