Example #1
0
$full_text = <<<EOT
dreamcraft.ch is a developement company based in Switzerland, aimed to create, integrate and mantain cutting-edge technology web applications.
We provide you our expertise in PHP/MySQL, Microsoft .NET and various Content Management Systems in order to develop new web applications or maintain and upgrade your current web sites.
Our philosophy:
Establish a durable and trustworthy win-win relation with our customers.
Use quality Open Source Software whenever possible.
Enforce good programming rules and standards to create better rich content web 2.0 applications.
A folk wisdom says "united we stand, divided we fall". As such we work closely with other Swiss companies to offer you an even larger range of skills.
Aicom are the creators of interactive web based tools such as FormFish, MettingPuzzle or MailJuggler.
oriented.net is a high-quality web hosting company based in Switzerland. Our partnership with them allows us to offer advanced hosting solutions to your web application.
EOT;
$font = dirname(__FILE__) . '/Arial.ttf';
$width = 600;
$height = 600;
$cloud = new WordCloud($width, $height, $font, $full_text);
$palette = Palette::get_palette_from_hex($cloud->get_image(), array('FFA700', 'FFDF00', 'FF4F00', 'FFEE73'));
$cloud->render($palette);
// Render the cloud in a temporary file, and return its base64-encoded content
$file = tempnam(getcwd(), 'img');
imagepng($cloud->get_image(), $file);
$img64 = base64_encode(file_get_contents($file));
unlink($file);
imagedestroy($cloud->get_image());
?>

<img usemap="#mymap" src="data:image/png;base64,<?php 
echo $img64;
?>
" border="0"/>
<map name="mymap">
<?php 
Example #2
0
 /**
  * custom or preset palette
  *
  * @param $params
  * @param $cloud
  * @return array
  */
 private function getPalette($params, $cloud)
 {
     $useCustomPalette = $params->get('wordleUseCustomPalette', '0');
     if ($useCustomPalette) {
         $customPalette = $params->get('wordleCustomPalette', 'CC6600,FFFBD0,FF9900,C13100');
         $palette = Palette::get_palette_from_hex($cloud->get_image(), explode(",", $customPalette));
         return $palette;
     } else {
         $palettes = array('aqua' => array('BED661', '89E894', '78D5E3', '7AF5F5', '34DDDD', '93E2D5'), 'yellow/blue' => array('FFCC00', 'CCCCCC', '666699'), 'grey' => array('87907D', 'AAB6A2', '555555', '666666'), 'brown' => array('CC6600', 'FFFBD0', 'FF9900', 'C13100'), 'army' => array('595F23', '829F53', 'A2B964', '5F1E02', 'E15417', 'FCF141'), 'pastel' => array('EF597B', 'FF6D31', '73B66B', 'FFCB18', '29A2C6'), 'red' => array('FFFF66', 'FFCC00', 'FF9900', 'FF0000'));
         $presetPalette = $params->get('wordlePresetPalette', 'aqua');
         $selectedPalette = $palettes[$presetPalette];
         $palette = Palette::get_palette_from_hex($cloud->get_image(), $selectedPalette);
         return $palette;
     }
 }
Example #3
0
        array('word' => "aaaa", 'count' => "0", 'title' => "cedric", 'link' => "cedric"),
        array('word' => "bbbbb", 'count' => "8", 'title' => "cedric", 'link' => "cedric"),
        array('word' => "bbbbb", 'count' => "0", 'title' => "cedric", 'link' => "cedric"),
        array('word' => "bbbbb", 'count' => "0", 'title' => "cedric", 'link' => "cedric"),
        array('word' => "bbbbb", 'count' => "5", 'title' => "cedric", 'link' => "cedric"),
        array('word' => "rrrrrr", 'count' => "2", 'title' => "cedric", 'link' => "cedric"),

    );
*/
$palettes = array('aqua' => array('BED661', '89E894', '78D5E3', '7AF5F5', '34DDDD', '93E2D5'), 'yellow/blue' => array('FFCC00', 'CCCCCC', '666699'), 'grey' => array('87907D', 'AAB6A2', '555555', '666666'), 'brown' => array('CC6600', 'FFFBD0', 'FF9900', 'C13100'), 'army' => array('595F23', '829F53', 'A2B964', '5F1E02', 'E15417', 'FCF141'), 'pastel' => array('EF597B', 'FF6D31', '73B66B', 'FFCB18', '29A2C6'), 'red' => array('FFFF66', 'FFCC00', 'FF9900', 'FF0000'));
$font = dirname(__FILE__) . '/Arial.ttf';
$width = 600;
$height = 600;
//$width, $height, $font, $text = null, $imagecolor = array(0, 0, 0, 127), $words_limit = null, $vertical_freq = FrequencyTable::WORDS_MAINLY_HORIZONTAL
$cloud = new WordCloud(16, 72, $width, $height, $font, $full_text);
$palette = Palette::get_palette_from_hex($cloud->get_image(), $palettes['grey'], 0, FrequencyTable::WORDS_MAINLY_HORIZONTAL);
$cloud->render($palette);
// Render the cloud in a temporary file, and return its base64-encoded content
$file = tempnam(getcwd(), 'img');
imagepng($cloud->get_image(), $file);
$img64 = base64_encode(file_get_contents($file));
unlink($file);
imagedestroy($cloud->get_image());
?>

<img usemap="#mymap" src="data:image/png;base64,<?php 
echo $img64;
?>
" border="0"/>
<map name="mymap">
    <?php