I am looking for a way to generate PNG images of equations from L A T E X source code embedded in templates. For example, given:
[% FILTER latex_display ] \begin{eqnarray*} \max && U(x,y) \\ \mathrm{st} && p_x x + p_y y \leq I \\ && x \geq 0, y \geq 0 \end{eqnarray*} [% END %]
I would like to get the output:
<div class="latex display"><img src="equation.png" width="x" height="y"></div>
which should ultimately appear as:

I use ttree to create documents offline. I know about Template :: Plugin :: Latex, but it aims to create real documents from L A T E X templates.
Any suggestions?
Update:
I appreciate the suggestions (and I voted for them). However, they are not exactly what I need. I would really appreciate some tips on getting started with the plugin or filter for the Template Toolkit.
source share