# This patch file was generated by NetBeans IDE # This patch can be applied using context Tools: Apply Diff Patch action on respective folder. # It uses platform neutral UTF-8 encoding. # Above lines and this line are ignored by the patching process. Index: moodle/filter/tex/filter.php --- moodle/filter/tex/filter.php Base (1.18.4.6) +++ moodle/filter/tex/filter.php Locally Modified (Based On 1.18.4.6) @@ -164,7 +164,7 @@ $texcache->timemodified = time(); insert_record("cache_filters",$texcache, false); } - $filename = $md5 . ".gif"; + $filename = "$md5.$CFG->filter_tex_extention"; $text = str_replace( $matches[0][$i], string_file_picture_tex($filename, $texexp, '', '', $align, $alt), $text); } return $text; Index: moodle/filter/tex/filtersettings.php --- moodle/filter/tex/filtersettings.php Base (1.1.2.2) +++ moodle/filter/tex/filtersettings.php Locally Modified (Based On 1.1.2.2) @@ -8,8 +8,12 @@ '', " \\usepackage[latin1]{inputenc}\n \\usepackage{amsmath}\n \\usepackage{amsfonts}\n \\RequirePackage{amsmath,amssymb,latexsym}\n"); $items[] = new admin_setting_configtext('filter_tex_latexbackground', get_string('backgroundcolour', 'admin'), '', '#FFFFFF'); $items[] = new admin_setting_configtext('filter_tex_density', get_string('density', 'admin'), '', '120', PARAM_INT); -$items[] = new admin_setting_configtext('filter_tex_density', get_string('density', 'admin'), '', '120', PARAM_INT); +$choises = array(); +$choises['gif'] = 'gif'; +$choises['png'] = 'png'; +$items[] = new admin_setting_configselect('filter_tex_extention', get_string('extention', 'tex'), '', 'gif', $choises); + if (PHP_OS=='Linux') { $default_filter_tex_pathlatex = "/usr/bin/latex"; $default_filter_tex_pathdvips = "/usr/bin/dvips"; Index: moodle/filter/tex/latex.php --- moodle/filter/tex/latex.php Base (1.9.2.1) +++ moodle/filter/tex/latex.php Locally Modified (Based On 1.9.2.1) @@ -91,7 +91,7 @@ * @param file $log valid open file handle for optional logging (debugging only) * @return bool true if successful */ - function render( $formula, $filename, $fontsize=12, $density=240, $background='', $log=null ) { + function render( $formula, $filename, $fontsize=12, $density=240, $background='', $extention='gif', $log=null ) { global $CFG; @@ -106,7 +106,7 @@ $tex = "{$this->temp_dir}/$filename.tex"; $dvi = "{$this->temp_dir}/$filename.dvi"; $ps = "{$this->temp_dir}/$filename.ps"; - $gif = "{$this->temp_dir}/$filename.gif"; + $gif = "{$this->temp_dir}/$filename.$extention"; // turn the latex doc into a .tex file in the temp area $fh = fopen( $tex, 'w' ); @@ -150,6 +150,7 @@ unlink( "{$this->temp_dir}/$filename.dvi" ); unlink( "{$this->temp_dir}/$filename.ps" ); unlink( "{$this->temp_dir}/$filename.gif" ); + unlink( "{$this->temp_dir}/$filename.png" ); unlink( "{$this->temp_dir}/$filename.aux" ); unlink( "{$this->temp_dir}/$filename.log" ); return; Index: moodle/filter/tex/pix.php --- moodle/filter/tex/pix.php Base (1.28.2.1) +++ moodle/filter/tex/pix.php Locally Modified (Based On 1.28.2.1) @@ -40,7 +40,9 @@ } if (!file_exists($pathname)) { - $md5 = str_replace('.gif','',$image); + $md5_and_extention = explode(".", $image); + $md5 = $md5_and_extention[0]; + $extention = $md5_and_extention[1]; if ($texcache = get_record('cache_filters', 'filter', 'tex', 'md5key', $md5)) { if (!file_exists($CFG->dataroot.'/filter/tex')) { make_upload_directory('filter/tex'); @@ -51,7 +53,7 @@ $density = $CFG->filter_tex_density; $background = $CFG->filter_tex_latexbackground; $texexp = html_entity_decode($texcache->rawtext); - $latex_path = $latex->render($texexp, $md5, 12, $density, $background); + $latex_path = $latex->render($texexp, $md5, 12, $density, $background, $extention); if ($latex_path) { copy($latex_path, $pathname); $latex->clean_up($md5); Index: moodle/filter/tex/texed.php --- moodle/filter/tex/texed.php Base (1.7.2.2) +++ moodle/filter/tex/texed.php Locally Modified (Based On 1.7.2.2) @@ -22,8 +22,8 @@ $texexp = str_replace('formdata=','',$texexp); if ($texexp) { - $image = md5($texexp) . ".gif"; - $filetype = 'image/gif'; + $image = md5($texexp) . ".$CFG->filter_tex_extention"; + $filetype = "image/$CFG->filter_tex_extention"; if (!file_exists("$CFG->dataroot/filter/tex")) { make_upload_directory("filter/tex"); } Index: moodle/lang/en_utf8/tex.php --- moodle/lang/en_utf8/tex.php Base (1.2) +++ moodle/lang/en_utf8/tex.php Locally Modified (Based On 1.2) @@ -3,5 +3,6 @@ $string['filtername'] = 'TeX Notation'; +$string['extention'] = 'Extention for image files'; ?>