Extension talk:PlantUML

Problem with Title
Hello! I've found a bug in the classical version - at least in combination with MediaWiki 1.15: The usage of $wgTitle as MD5 source does not work - it always results in an empty string. As a result, all images are stored as "uml--(CodeHash).png" - and when another page is saved, the cleanImages deletes ALL images. Other (cached) pages then can't find their images unless they are re-created.

As a fix, instead of using global $wgTitle (which is also described as not to be used), I'm using the following function: function getPageTitle { global $wgArticle; $title = $wgArticle->getTitle->getText; return $title; } and use getPageTitle instead of $wgTitle.

I don't know whether this is the best solution, but for now it works as intended - image files are stored with a proper hash for the title AND are kept for all pages :).

- Ok, thanks, I've just made the correction (April 29th, 2011)

Actually, it seems to depend of MediaWiki, so I suggest the following code:

function getPageTitle { global $wgArticle; global $wgTitle; // Retrieving the title of a page is not that easy if (empty($wgTitle)) { $title = $wgArticle->getTitle->getText; return $title; }   return $wgTitle; } Any though ?

GraphViz
I found that GraphViz was required to have this working... you might want to add this to the install instructions?

- Ok, thanks for this suggestion!

Changed font
Hi - I installed on our test environment (without GraphWiz) and it worked fine (the first example on the article page). But on our real environment the font suddenly changed (test: Arial, real: some kind of joined up Word link font). Any idea why this is? The skin on both is the same. --Robinson Weijman 11:27, 5 February 2010 (UTC)

I am not sure to understand your issue. Could you contact me by mail (plantuml@gmail.com) ? Thanks - 13 February 2010
 * Thanks for the reply. We solved the issue - each environment had a different version of java.  Now that this is corrected, the problem is resolved.  --Robinson Weijman 09:17, 15 February 2010 (UTC)

Spaces in Windows Apache Home Path
On my windows machine I had to change:

to

Otherwise the script failed because of some spaces in the installation path of the Apache. Maybe someone with more experience in php than myself could fix this to a more robust version.

How it run into CentOS?

 * It works in Ubuntu and FreeBSD, but i can't run it into CentOS.

You should double check that the Sun JVM is used, and not the OpenJDK.

error on uploading?
hello

I get this error when doing regular uploads

Fatal error: Call to a member function getTitle on a non-object in /var/www/tids/extensions/PlantUML.php on line 181

BTW useful extension and thanks

Msevero 08:06, 30 April 2011 (UTC)

Ok, I just change the getPageTitle function. Does it work better ?

PlantUML 20:19, 30 April 2011 (UTC)

CPanel Centos php.ini edit fix
In running my MediaWiki off of a CPanel hosted site I was continually getting:

[An error occured in PlantUML extension]

Every now and then I would see this:

Warning: copy [function.copy]: URL file-access is disabled in the server configuration in /home/username/public_html/extensions/PlantUML.php on line 98 Warning: copy(http://www.plantuml.com/plantuml/img/ROr1RW8n34NtEOMNPT4B83GIK9LkA8jH3_0Ph19D9XuSJojktoI3119Tsdv-pwNUnn6AWQR47H9lqFNVAbCyRIM8qXkqRnaxPOxkYLwhokyC7eB_uGS2dObkH4-iCt0CMVsiU4HgBC1ufxZ-KolATudsYO5fAvDwLkU-4YkjLlGn3OZKD6wvXuzPPZZchoKXqVxQNaA1rkCOV0VpKj6Nrg2sA9T3P6hFOdMTdMHd9jpnHV6KGwLh8fDp_RMXc-asbqL1tHo-pty0) [function.copy]: failed to open stream: no suitable wrapper could be found in /home/username/public_html/extensions/PlantUML.php on line 98

After some Google Searching I found references to disabling this by default to prevent certain attacks.

Create a php.ini file containing this entry:

allow_url_fopen = On

Upload it to /username/public_html (where your LocalSettings.php file would be) and now I no longer get the error messages and the PlantUML files render as expected in the article.

New classic version.
Hi, I would like to contribute a new "classic version" which follows mediawiki standards more and is able to handle image maps and SVG graphics. Pleas advise for best approach.

--Pjkersten 15:23, 5 May 2011 (UTC)

Hello, good idea! It depends wether you know already MediaWiki engine or not. Any maybe it should be better to put the code of this new "classic version" into a really repository (SVN/GIT). For imagemap, as long as there are some URL in the diagram description, a cmap file will be generated with the PNG file. (See [])

You will probably have to parse this cmap file.

You may have a look to this extension Extension:ImageMap which shows how to enable imagemap in MediaWiki.

--Plantuml 17:17, 5 May 2011 (UTC)

Actually, it's already finished. Tested and working - at least, for me that is. Any preferences for bzr, sf or git?

--Pjkersten 19:59, 5 May 2011 (UTC)

Wow, I am curious to see the result. Thanks for your job. Actually, since several plugins are on [] so maybe git is a good option.

--Plantuml 20:49, 5 May 2011 (UTC)

I've created a project on github If you have remarks, please mail me (somehow I don't receive updates for this page).

--Pjkersten 10:04, 6 May 2011 (UTC)

Quick & dirty fix to allow additional html tags for formatting (and linking to source picture)
Hi,

I did a small modification to the PNG rendering to add custom html tags to the header. Reason was to reduce the resulting image size. The image now also links to the original file behind.

Changed functions below. Modified and tested only the PNG case, renderSVG still has to be modified.

function renderPNG($image,$argv) { //the same... if ($image['map']) { $usemap = ' usemap="#'.$image['mapid'].'"'; } else { $usemap = ''; }   return "{$image['map']}"; //added $argv and link here }

function renderUML( $input, $argv, $parser=null ) { global $plantumlImagetype; $image = getImage($input, $parser); if ($image['src'] == false) { $text = "[An error occured in PlantUML extension]"; } else { if ($plantumlImagetype == 'svg') { $text = renderSVG($image); } else { //recreate html-tags from $argv $args = ''; foreach ($argv as $tag => $tagval) {			$args .= " $tag=\"$tagval\" "; }           $text = renderPNG($image,$args); //added $args to function call }   }    return $text; }

PlantUML with a dedicated plantuml server behind proxy
Hello,
 * while using plantuml with a dedicated instance in cloud mode

$usecloud = true;
 * you should sometime be able to specify a proxy (eg. avoiding "Connect timeout" error).
 * To do this, you should replace " " by a dedicated mechanism including proxy config.
 * Here is the actual code (PlantUml.php:line 231)


 * Here is the expecting code to set "betweenProxyHost.intranet'" proxy server : a proxy between your mediawiki server and the dedicated.plantuml.server.intranet src :


 * Enjoy.
 * --Boly38 (talk) 13:18, 19 February 2013 (UTC)

Strange grey line shows up around the boarders of PlantUML-images
Hi!

I use mwlib to generate PDF articles from MediaWiki documents. We use PlantUML with Graphviz 2.30.0. Of some strange reason, under the UML diagram pictures strange grey lines always appear on the converted PDF-files. See picture. http://img211.imageshack.us/img211/7321/6e3s.png

Anyone got any idea of to fix this and take away the grey lines? Thanks in advance!

PS: The grey lines shows up only in the PDF-documents, not the WikiaArticles they were generated from. When you view the PDF file in Ubuntu, the entire images has a grey border around it, and in Windows it's only the line below the image like in the picture above.

--Samuelspik (talk) 14:54, 31 July 2013 (UTC)

X11 connection rejected because of wrong authentication
I am trying to run PlantUML on a linux hosted wiki.

I keep getting a "X11 connection rejected because of wrong authentication" error when the java command runs. Any ideas on how to deal with this?

Thanks

/usr/bin/java -jar /data/mediawiki/extensions/PlantUml/plantuml.jar -tsvg -o "/data/mediawiki/web_support/images" "/data/mediawiki/web_support /images/uml-ebd4e0d7be03d05feba0724a4aee627b-b77cde4509f8f99422145350f34866e7.uml" X11 connection rejected because of wrong authentication. Exception in thread "main" java.lang.InternalError: Can't connect to X11 window server using 'localhost:10.0' as the value of the DISPLAY variable. at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method) at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:77) at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:122) at java.security.AccessController.doPrivileged(AccessController.java:229) at sun.awt.X11GraphicsEnvironment. (X11GraphicsEnvironment.java:86) at java.lang.J9VMInternals.initializeImpl(Native Method) at java.lang.J9VMInternals.initialize(J9VMInternals.java:241) at java.lang.Class.forNameImpl(Native Method) at java.lang.Class.forName(Class.java:139) at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:113) at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:92) at java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1163) at net.sourceforge.plantuml.EmptyImageBuilder. (Unknown Source) at net.sourceforge.plantuml.svek.CucaDiagramFileMakerSvek. (Unknown Source) at java.lang.J9VMInternals.initializeImpl(Native Method) at java.lang.J9VMInternals.initialize(J9VMInternals.java:241) at net.sourceforge.plantuml.cucadiagram.CucaDiagram.exportDiagramInternal(Unknown Source) at net.sourceforge.plantuml.UmlDiagram.exportDiagram(Unknown Source) at net.sourceforge.plantuml.PSystemUtils.exportDiagramsCuca(Unknown Source) at net.sourceforge.plantuml.PSystemUtils.exportDiagrams(Unknown Source) at net.sourceforge.plantuml.SourceFileReader.getGeneratedImages(Unknown Source) at net.sourceforge.plantuml.Run.manageFileInternal(Unknown Source) at net.sourceforge.plantuml.Run.processArgs(Unknown Source) at net.sourceforge.plantuml.Run.manageAllFiles(Unknown Source) at net.sourceforge.plantuml.Run.main(Unknown Source)

Make output auto-resize
First, add these codes into your MediaWiki:common.css

Then, go to plantUML.php, and change:

Original Line 382

Modified Line 382

-Joshua.yathin.yu (talk) 09:18, 20 November 2013 (UTC)

No png image generated by PlantUML is shown when we generate a book with Collection
We installed the PlantUML, GraphViz and Collection extensions. To generate the books with Collection we have installed a render server. When we try to generate a book adding pages with PlantUML graphics, they are not displayed in the generated pdf. Is there any way to display them in the book?