I just want to add how I finally implemented your code.
If I have specific parts on my page, where I use latex equations I call a php function, which checks whether the images for these equations have already been cached.
If they have been cached, I replace the equation with a link to the local image.
If they haven't been cached, I surround the equation with a code tag (e.g. '<code class="latex_formula">6 = 2 \cdot 3</code>').
Then when the page is loaded, a javascript function iterates through all these tags and calls a php function via ajax, which pulls the image for the equation from codecogs servers (like your one above).
Thus I have a fast page loading time, because the images for the equations can be loaded after the main part of the page has been loaded.
Dennis
Login