| … | |
… | |
| 44 | |
44 | |
| 45 | =over |
45 | =over |
| 46 | |
46 | |
| 47 | =item new |
47 | =item new |
| 48 | |
48 | |
| 49 | Returns a new ImageGenerator object. <C%options> must contain the following entries: |
49 | Returns a new ImageGenerator object. <C%options> must contain the following |
|
|
50 | entries: |
| 50 | |
51 | |
| 51 | tempDir => directory for storing temporary files (non-web accessible) |
52 | tempDir => directory in which to create temporary processing directory |
| 52 | dir => directory for resulting files |
53 | dir => directory for resulting files |
| 53 | url => url to directory for resulting files |
54 | url => url to directory for resulting files |
| 54 | basename => base name for image files |
55 | basename => base name for image files |
| 55 | latex => path to latex binary |
56 | latex => path to latex binary |
| 56 | dvipng => path to dvipng binary |
57 | dvipng => path to dvipng binary |
| … | |
… | |
| 68 | bless $self, $class; |
69 | bless $self, $class; |
| 69 | } |
70 | } |
| 70 | |
71 | |
| 71 | =item add($string, $mode) |
72 | =item add($string, $mode) |
| 72 | |
73 | |
| 73 | Adds the equation in C<$string> to the object. C<$mode> can be "display" or "inline". If |
74 | Adds the equation in C<$string> to the object. C<$mode> can be "display" or |
| 74 | not specified, "inline" is assumed. Returns the proper HTML tag for displaying the image. |
75 | "inline". If not specified, "inline" is assumed. Returns the proper HTML tag |
|
|
76 | for displaying the image. |
| 75 | |
77 | |
| 76 | =cut |
78 | =cut |
| 77 | |
79 | |
| 78 | sub add { |
80 | sub add { |
| 79 | my ($self, $string, $mode) = @_; |
81 | my ($self, $string, $mode) = @_; |
| … | |
… | |
| 106 | } |
108 | } |
| 107 | } |
109 | } |
| 108 | |
110 | |
| 109 | =item render(%options) |
111 | =item render(%options) |
| 110 | |
112 | |
| 111 | Uses LaTeX and dvipng to render the equations stored in the object. If the key "mtime" in |
113 | Uses LaTeX and dvipng to render the equations stored in the object. If the key |
| 112 | C<%options> is given, it will be interpreted as a unix date and compared with the |
114 | "mtime" in C<%options> is given, its value will be interpreted as a unix date |
| 113 | modification date on any existing copy of the first image to be generated. It is |
115 | and compared with the modification date on any existing copy of the first image |
| 114 | recommended that the modification time of the source file from which the equations |
116 | to be generated. It is recommended that the modification time of the source |
| 115 | originate be used for this value. If the key "refresh" in C<%options> is true, images |
117 | file from which the equations originate be used for this value. If the key |
| 116 | will be regenerated regardless of when they were last modified. |
118 | "refresh" in C<%options> is true, images will be regenerated regardless of when |
|
|
119 | they were last modified. If neither option is supplied, "refresh" is assumed. |
| 117 | |
120 | |
| 118 | =cut |
121 | =cut |
| 119 | |
122 | |
| 120 | sub render { |
123 | sub render { |
| 121 | my ($self, %options) = @_; |
124 | my ($self, %options) = @_; |