Jump to content

Extension talk:ExternalUML

About this board

Yuml specific stuff is broken

1
208.87.222.10 (talkcontribs)

Perhaps if I have more time I can edit the wiki...but this seems like a decent option to get this info here.

The problem is dsls greater than some fixed size do not work when you try to encode them as http parameters. I'm assuming that there is some size limitation somewhere. This size limitation hits me at around 10 classes with somewhat verbose class names (sentences as opposed to words).

The solution is to use POSTS with GETS (same thing done with calls to 'websequencediagrams').

A quarter-assed workaround is to replace calls to getYumlImageUrl in the callback function to a call to the following function. Note, i'm posting this piece of doo-doo because I don't do PHP/mediawiki/extensions so I ran into a lot of difficulties to make this simple change..and i'm trying to save others. Obviously to complete this solution you just make it handle the various yuml.me options.


function getBigYuml( $input, $args ) {
   /* HTTP Post to www.yuml.me to generate and retrieve the corresponding image                                                                                                                             
    */
                                                                                                                                         
 $uml_code = preg_replace(
                          array("/\n/", "/,,/"),
                          array(", ",   ","   ),
                          trim($input));

 $postdata = http_build_query(
       array(
           'dsl_text' => $uml_code
       )
   );

   $opts = array('http' =>
       array(
           'method'  => 'POST',
           'header'  => 'Content-type: application/x-www-form-urlencoded',
           'content' => $postdata
       )
   );

   $context  = stream_context_create($opts);                                                                                                        
   $result = file_get_contents('http://www.yuml.me/diagram/scruffy;scale:80;/class/', false, $context);


   /* Extract the "img" attribute of the JSON response.                                                                                                                                                     
    * Note:  If json isn't available, use hardcoded:                                                                                                                                                        
    *          strstr(substr($result, 9), '"', true);                                                                                                                                                       
    */
   //$json_o = json_decode($result);                                                                                                                                                                        
   $plain_text=$result;
   return "http://www.yuml.me/diagram/scruffy/class/".$plain_text;
}
Reply to "Yuml specific stuff is broken"
There are no older topics