splitbrain / dokuwiki-plugin-ditaa

Renders ASCII flowcharts contained in a DokuWiki page to images
http://www.dokuwiki.org/plugin:ditaa
5 stars 5 forks source link

Local Generation Not Working #1

Closed CornMaster closed 14 years ago

CornMaster commented 14 years ago

Rendering via the web service works fine, but after installing the plugin, and upgrading the Java on the server, and setting the configuration variable to point to the java, nothing renders when viewing the page. Not sure if there is a configuration setting, or a specific version of Java required.

Java Version: [root@server ~]# /usr/bin/java -version java version "1.6.0_0" OpenJDK Runtime Environment (IcedTea6 1.6) (rhel-1.11.b16.el5-i386) OpenJDK Server VM (build 14.0-b16, mixed mode)

Running Red Hat 5 on this server.

Thanks

rnieuwstad commented 14 years ago

Had exactly the same issue and it had me stumped for a while but I finally managed to solve it in the end (though I'm still stumped - I'm no good with php).

After installing the plugin at work (where it worked) I found my ditaa.php (in the lib/plugins/ditaa directory) was missing the following line:

require_once(DOKU_INC.'inc/httputils.php');

Quite why this was missing I have no idea - as far as I can determine the same version of the plugin was used on both sites...

My ditaa.php now looks like this: <?php /**

if(!defined('DOKU_INC')) define('DOKU_INC',realpath(dirname(FILE).'/../../../').'/'); define('NOSESSION',true); require_once(DOKU_INC.'inc/init.php'); require_once(DOKU_INC.'inc/pageutils.php'); require_once(DOKU_INC.'inc/httputils.php'); require_once(DOKU_INC.'inc/io.php');

$data = $_REQUEST; $w = (int) $data['width']; $h = (int) $data['height']; unset($data['width']); unset($data['height']); unset($data['align']);

$cache = getcachename(join('x',array_values($data)),'ditaa.png');

// create the file if needed if(!file_exists($cache)){ $plugin = plugin_load('syntax','ditaa'); $plugin->_run($data,$cache); clearstatcache(); }

// resized version if($w) $cache = media_resize_image($cache,'png',$w,$h);

// something went wrong, we're missing the file if(!file_exists($cache)){ header("HTTP/1.0 404 Not Found"); echo 'Not Found'; exit; }

header('Content-Type: image/png;'); header('Expires: '.gmdate("D, d M Y H:i:s", time()+max($conf['cachetime'], 3600)).' GMT'); header('Cache-Control: public, proxy-revalidate, no-transform, max-age='.max($conf['cachetime'], 3600)); header('Pragma: public'); http_conditionalRequest($time); echo io_readFile($cache,false);

//Setup VIM: ex: et ts=4 enc=utf-8 :

Suggest you update ditaa.php with the above and try again.

splitbrain commented 14 years ago

if the missing require was the problem, this should be fixed now