<?php $execution_time_limit = 60; set_time_limit($execution_time_limit); $img = "<img src=http://www.plantuml.com/plantuml/img/"; $img .= encodep($_POST["plantUMLstring"]); $img .= ">"; echo $img; ?> <?php function encodep($text) { $data = utf8_encode($text); $compressed = gzdeflate($data, 9); return encode64($compressed); } function encode6bit($b) { if ($b < 10) { return chr(48 + $b); } $b -= 10; if ($b < 26) { return chr(65 + $b); } $b -= 26; if ($b < 26) { return chr(97 + $b); } $b -= 26;
/** * Renders a PlantUML model by the using the following method: * - Encode the source like explained here: http://plantuml.sourceforge.net/codephp.html * - Use as filename a md5 hash of the uml source * - Copy the image generated by http://www.plantuml.com in the upload directory * * @param string PlantUML_Source: the source of the UML image * @param string imgFile: full path of to-be-generated image file. * @returns true if the picture has been successfully saved to the picture * cache directory */ function renderPlantUML_cloud($PlantUML_Source, $imgFile) { // Build URL that describes the image $img = "http://www.plantuml.com/plantuml/img/"; $img .= encodep($PlantUML_Source); // Copy images into the local cache copy($img, $imgFile); if (is_file($imgFile)) { return $imgFile; } return false; }