====== svg.php ====== This is a plugin to DokuWiki to allow collaborative generation of SVG images. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * -------------------------------------------------------------------- * @author Chris Lee * @version v0.1 * @package svgconvert * This file can be included in many PHP programs by using something like (see example.php to see how it can be used) * include_once('/full_path_here_to/svgconvert/svg.php'); * $text_to_be_converted=svg_content($text_to_be_converted); * $text_to_be_converted will then contain the link to the appropriate image * or an error message. */ function svg_content($text) { global $conf; $svgconvert_path = "/opt/lampp/htdocs/hosts/chrislee.dhs.org/html/wiki/inc/svgconvert"; $svgconvert_path_http = "/wiki/media/svgconvert"; $svgconvert_media_path = "/opt/lampp/htdocs/hosts/chrislee.dhs.org/html/wiki/media/svgconvert"; $ImageMagick_convert = "/usr/bin/convert"; $filename = md5($text).".gif"; $localfile = "$svgconvert_media_path/$filename"; $tempfile = $svgconvert_path."/tmp/".$filename.".svg"; $url = $svgconvert_path_http."/".$filename; if ( file_exists( $localfile ) ) return ( "" ); else { $fp = fopen( $tempfile, 'w' ); fputs( $fp, $text ); fclose( $fp ); exec( "$ImageMagick_convert $tempfile $localfile" ); unlink( $tempfile ); if ( file_exists( $localfile ) ) return ( "" ); else return ( "Could not create SVG Image
\n" ); } } ?>