Some of us might need to distribute graphs to 3rd parties. It would nice to have company logo on the graph, that you don't have to that via photo editor.
This is not the final solution I'd like to have, but this is working. What would be nice is to upload background/icon to Zabbix, and define by "theme" or by graph-template that attach that uploaded background/icon to every graph. Or add free copyright notice as a text.
However here is my quick fix.
This is not the final solution I'd like to have, but this is working. What would be nice is to upload background/icon to Zabbix, and define by "theme" or by graph-template that attach that uploaded background/icon to every graph. Or add free copyright notice as a text.
However here is my quick fix.
- Upload picture to zabbix frontend root-directory. Lets say it is "logo.png", and you can use transparency.
- Attach following patch to /include/classes/class.cgraphdraw.php. Search function drawLogo() and replace it with following code.
Code:
public function drawLogo(){
imagestringup($this->im,0,$this->fullSizeX-10,$this->fullSizeY-50, 'http://www.zabbix.com', $this->getCol
// Add the company logo
$stamp = imagecreatefrompng('logo.png');
$sx = imagesx($stamp);
$sy = imagesy($stamp);
$marge_right = 15;
$marge_bottom = 15;
imagecopy($this->im, $stamp, imagesx($this->im) - $sx - $marge_right, imagesy($this->im) - $sy - $marge_b
}
- Based on your logo size and how you want to position the logo, tune marge_right and marge_bottom to suit your needs. Naturally you can change the calculation base of imagecopy to whatever you like, i.e. to position your logo everywhere.
- I didn't check the drawing order, if you could even position the graph on top you the figure drawn. Just use a lot of transparency if it is supported by GD library at this drawing state.
- Or if logo is too much for you, you can use imagestring and imagestringup to write your own text on top of picture. More info what possibly can be done: http://www.php.net/manual/en/ref.image.php

Comment