简体   繁体   中英

How to get Image in MediaWiki extension?

I'm updating a MediaWiki extension that nicely formats Bibtex extensions ( this one ). One feature is that when a link to a PDF is present then that link gets presented with a PDF icon. This icon is an image uploaded to the wiki as any other file (ie it's not part of the extension itself). The code then accesses this image like this:

$im2 = Image::newFromName("PDF.png");

However, the Image class has been deprecated and removed (I'm using version 1.19). I see that "images" are now "files", but it's unclear to me what the new equivalent of the above is.

I could just hard-code the image filename, but that would not be portable to other setups. I would like to keep this approach of using an image uploaded to the wiki, if possible.

How can I work with files uploaded to a MediaWiki through the MediaWiki API?

看起来wfFindFile函数现在可以这样做:

$im2 = wfFindFile("PDF.png");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM