Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errorimage does not render on systems without GD ttf support #1351

Closed
duhow opened this issue Feb 14, 2018 · 3 comments
Closed

Errorimage does not render on systems without GD ttf support #1351

duhow opened this issue Feb 14, 2018 · 3 comments

Comments

@duhow
Copy link
Contributor

duhow commented Feb 14, 2018

Not sure when happened, but I think it's because RRD file not existing and try to Turn On Data Source Debug Mode.

PHP Warning:  imagestring() expects parameter 6 to be integer, string given in /var/www/cacti-1.1.35/lib/rrd.php on line 3401, referer: http://cacti-test/graphs.php?action=graph_edit&id=4
@netniV
Copy link
Member

netniV commented Feb 14, 2018

This is actually not because of that but because you don't have TrueType enabled on your system and there is a bug with the imagestring call. It should be using $text_color not $font_color.

At line 3362, it allocates the color correctly. However, at line 3401 when it tries to use image_string() it's using font_color which is actually a hex encoded RGB string so would never work.

@netniV
Copy link
Member

netniV commented Feb 14, 2018

Try this patch:

diff --git a/lib/rrd.php b/lib/rrd.php
index b7688ac..59662f0 100644
--- a/lib/rrd.php
+++ b/lib/rrd.php
@@ -3398,7 +3398,7 @@ function rrdtool_create_error_image($string, $width = '', $height = '') {
        } else {
                foreach($strings as $string) {
                        if (trim($string) != '') {
-                               if (!imagestring($image, $font_size, $xpos, $ypos, $string, $font_color)) {
+                               if (!imagestring($image, $font_size, $xpos, $ypos, $string, $text_color)) {
                                        cacti_log('Text overlay failed');
                                }
                                $ypos -= ($font_size + $padding);

@cigamit cigamit changed the title PHP GD parameter content mismatch Errorimage does not render on systems without GD ttf support Feb 14, 2018
cigamit added a commit that referenced this issue Feb 14, 2018
Errorimage does not render on systems without GD ttf support
@cigamit
Copy link
Member

cigamit commented Feb 14, 2018

This issue is resolved now. Thanks for taking the time to report.

@cigamit cigamit closed this as completed Feb 14, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants