From: <var...@us...> - 2014-11-21 09:42:59
|
Revision: 9357 http://sourceforge.net/p/phpwiki/code/9357 Author: vargenau Date: 2014-11-21 09:38:52 +0000 (Fri, 21 Nov 2014) Log Message: ----------- Avoid constant reassignment Modified Paths: -------------- trunk/lib/plugin/TexToPng.php Modified: trunk/lib/plugin/TexToPng.php =================================================================== --- trunk/lib/plugin/TexToPng.php 2014-11-21 09:38:11 UTC (rev 9356) +++ trunk/lib/plugin/TexToPng.php 2014-11-21 09:38:52 UTC (rev 9357) @@ -74,18 +74,6 @@ | *----------------------------------------------------------------------*/ -// check boolean constants - -if (!defined('TexToPng_debug')) { - define('TexToPng_debug', false); -} -if (!defined('TexToPng_antialias')) { - define('TexToPng_antialias', false); -} -if (!defined('TexToPng_transparent')) { - define('TexToPng_transparent', false); -} - /*----------------------------------------------------------------------- | WikiPlugin_TexToPng *----------------------------------------------------------------------*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-06-22 16:26:36
|
Revision: 10315 http://sourceforge.net/p/phpwiki/code/10315 Author: vargenau Date: 2021-06-22 16:26:35 +0000 (Tue, 22 Jun 2021) Log Message: ----------- Make lib/plugin/TexToPng.php work Modified Paths: -------------- trunk/lib/plugin/TexToPng.php Modified: trunk/lib/plugin/TexToPng.php =================================================================== --- trunk/lib/plugin/TexToPng.php 2021-06-22 15:27:04 UTC (rev 10314) +++ trunk/lib/plugin/TexToPng.php 2021-06-22 16:26:35 UTC (rev 10315) @@ -39,9 +39,6 @@ *----------------------------------------------------------------------*/ // needs (la)tex, dvips, gs, netpbm, libpng // LaTeX2HTML ftp://ftp.dante.de/tex-archive/support/latex2html -$texbin = '/usr/bin/tex'; -$dvipsbin = '/usr/bin/dvips'; -$pstoimgbin = '/usr/bin/pstoimg'; // output mere debug messages (should be set to false in a stable // version) @@ -266,11 +263,14 @@ function TexToImg($texstr, $scale, $aalias, $transp) { - //$cacheparams = $GLOBALS['CacheParams']; + $texbin = '/usr/bin/tex'; + $dvipsbin = '/usr/bin/dvips'; + $pstoimgbin = '/usr/bin/pstoimg'; + $cache_dir = '/tmp/cache'; $tempfiles = $this->tempnam('TexToPng'); $img = 0; // $size = 0; - // procuce options for pstoimg + // produce options for pstoimg $options = ($aalias ? '-aaliastext -color 8 ' : '-color 1 ') . ($transp ? '-transparent ' : '') . @@ -280,7 +280,7 @@ // rely on intelligent bool interpretation $ok = $tempfiles && $this->createTexFile($tempfiles . '.tex', $texstr) && - $this->execute('cd ' . $cacheparams['cache_dir'] . '; ' . + $this->execute('cd ' . $cache_dir . '; ' . "$texbin " . $tempfiles . '.tex', true) && $this->execute("$dvipsbin -o" . $tempfiles . '.ps ' . $tempfiles . '.dvi') && $this->execute("$pstoimgbin $options" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-06-24 17:14:06
|
Revision: 10325 http://sourceforge.net/p/phpwiki/code/10325 Author: vargenau Date: 2021-06-24 17:14:05 +0000 (Thu, 24 Jun 2021) Log Message: ----------- TexToPng.php: check thet file exists before unlinking it Modified Paths: -------------- trunk/lib/plugin/TexToPng.php Modified: trunk/lib/plugin/TexToPng.php =================================================================== --- trunk/lib/plugin/TexToPng.php 2021-06-24 17:13:14 UTC (rev 10324) +++ trunk/lib/plugin/TexToPng.php 2021-06-24 17:14:05 UTC (rev 10325) @@ -299,13 +299,24 @@ if (!TexToPng_debug || (TexToPng_debug && $ok)) { if ($tempfiles) { - unlink($tempfiles); - unlink($tempfiles . '.ps'); - unlink($tempfiles . '.tex'); - //unlink($tempfiles . '.aux'); - unlink($tempfiles . '.dvi'); - unlink($tempfiles . '.log'); - unlink($tempfiles . '.png'); + if (file_exists($tempfiles)) { + unlink($tempfiles); + } + if (file_exists($tempfiles . '.ps')) { + unlink($tempfiles . '.ps'); + } + if (file_exists($tempfiles . '.tex')) { + unlink($tempfiles . '.tex'); + } + if (file_exists($tempfiles . '.dvi')) { + unlink($tempfiles . '.dvi'); + } + if (file_exists($tempfiles . '.log')) { + unlink($tempfiles . '.log'); + } + if (file_exists($tempfiles . '.png')) { + unlink($tempfiles . '.png'); + } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |