|
|
@@ -38,9 +38,51 @@ class restful extends PluginStrategy
|
|
|
$this->AddRoute("POST /api.ws.getstatus/@labelid", __NAMESPACE__ . '\restful->RESTful_GetStatus');
|
|
|
$this->AddRoute("POST /api.ws.getlabelsfromap/@ap_id", __NAMESPACE__ . '\restful->RESTful_GetLabelsFromAP');
|
|
|
|
|
|
+ // TODO NEW OMLINK TPL GENERATOR
|
|
|
+ $this->AddRoute("GET /api.ws.gentpl", __NAMESPACE__ . '\restful->RESTful_gentpl');
|
|
|
+
|
|
|
$this->findBoxCore = new FindBoxCoreSystem(...array_values($f3->get('CORE.fb')));
|
|
|
}
|
|
|
|
|
|
+ public function RESTful_gentpl($f3)
|
|
|
+ {
|
|
|
+ $varCondizione = 0;
|
|
|
+
|
|
|
+ $grafica = [
|
|
|
+ 'BODY' => ['w' => 100, 'h' => 100],
|
|
|
+ 'TEXT1' => [
|
|
|
+ 'x' => '0',
|
|
|
+ 'y' => '18',
|
|
|
+ 'size' => 18,
|
|
|
+ 'color' => $varCondizione == 1 ? '#FFFFFF' : '#00FF00',
|
|
|
+ 'value' => 'ciao'
|
|
|
+ ],
|
|
|
+ 'TEXT2' => [
|
|
|
+ 'x' => '0',
|
|
|
+ 'y' => '37',
|
|
|
+ 'size' => 12,
|
|
|
+ 'color' => '#FF0000',
|
|
|
+ 'value' => 'booohh'
|
|
|
+ ]
|
|
|
+ ];
|
|
|
+
|
|
|
+ $image = null;
|
|
|
+ foreach($grafica as $element => $gdElement) {
|
|
|
+ switch (substr($element, 0, 4)) {
|
|
|
+ case 'BODY':
|
|
|
+ $image = imagecreatetruecolor($gdElement['w'], $gdElement['h']);
|
|
|
+ break;
|
|
|
+ case 'TEXT':
|
|
|
+ list($r, $g, $b) = sscanf($gdElement['color'], "#%02x%02x%02x");
|
|
|
+ $color = imagecolorallocate($image, $r, $g, $b);
|
|
|
+ imagettftext($image, $gdElement['size'], 0, $gdElement['x'], $gdElement['y'], $color, 'C:\Windows\Fonts\arial.ttf', $gdElement['value']);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ imagepng($image, 'c:\ciao.png');
|
|
|
+ imagedestroy($image);
|
|
|
+ }
|
|
|
+
|
|
|
public function RESTful_ListAPIS($f3)
|
|
|
{
|
|
|
$apiList = array_filter(array_keys($f3->ROUTES), function ($item) {
|