2011/1/20 Gabriel Sandor <firstname.lastname@example.org>
So eventually I tried this and indeed it works as expected. I have one more question though.
I've seen that most of the complex math formulas are converted into .png images with some long names - for instance, the <math>\iiiint\limits_F \, dx\,dy\,dz\,dt</math> formula (triple integral) is converted into an image with the name 49005f50f3ba2dfade3a265ebe363ee9.png. I'd like to know, is this file name unique for each formula ? And is it persisted on the wiki's server indefinitely, just like other images in articles ? To be more clear, is the triple integral formula always going to be associated to this 49005f50f3ba2dfade3a265ebe363ee9.png file ?
I'm trying to implement a cache mechanism in my app that tries to
also deal with images generated from math markup (besides usual images
in articles), that's why I have this curiosity. I'd like to know if I can safely associate a math markup string with a file name so that there's no need to retrieve the image from the server again when I encounter that formula.
On Mon, Dec 13, 2010 at 1:23 PM, Roan Kattouw <email@example.com>
2010/12/13 Gabriel Sandor <firstname.lastname@example.org>:
> Is it possible to retrieve (preferably via the MediaWiki API) an imageThere's no direct way to do this, although I guess it could be
> representing a mathematical formula given in the <math> tags that are
> frequently encountered in Wikipedia articles ?
implemented. A workaround would be to do something like
, which will give you the HTML generated for this <math> tag, which
could be an image (like in this case), or HTML if the formula is
sufficiently simple (try a^2+b^2=c^2 for instance).
Roan Kattouw (Catrope)
Yes, the name is unique, I discovered by reverse engineering that it is merely "the MD5 transformation of the normalized TeX code". An intelligent trick that, I guess, points directly on the png image without any need to calculate it again: I presume that the name only is calculated, and, if the png exists, it is uploaded! The "normalized TeX code", I guess, is the text that you can see browsing the html code, into the "alt" attribute of the image tag.
There are online free MD5 coders somewhere into the web, try the conversion of alternate text.
Nothing of this is documented, I discovered it by myself; can be, I'm absolutely wrong. :-)