mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
base64 images pdf
This commit is contained in:
parent
ab1c6e17ca
commit
415a54fb55
@ -3570,6 +3570,7 @@ function agents_get_network_interfaces_array(
|
|||||||
'server_id' => $id_meta,
|
'server_id' => $id_meta,
|
||||||
'height' => $config['graph_image_height'],
|
'height' => $config['graph_image_height'],
|
||||||
'landscape' => $content['landscape'],
|
'landscape' => $content['landscape'],
|
||||||
|
'return_img_base_64' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
$params_combined = [
|
$params_combined = [
|
||||||
@ -3581,11 +3582,21 @@ function agents_get_network_interfaces_array(
|
|||||||
case 'dinamic':
|
case 'dinamic':
|
||||||
case 'static':
|
case 'static':
|
||||||
if (!empty($interface['traffic'])) {
|
if (!empty($interface['traffic'])) {
|
||||||
|
if ($pdf === false) {
|
||||||
$row_interface['chart'] = graphic_combined_module(
|
$row_interface['chart'] = graphic_combined_module(
|
||||||
array_values($interface['traffic']),
|
array_values($interface['traffic']),
|
||||||
$params,
|
$params,
|
||||||
$params_combined
|
$params_combined
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
$row_interface['chart'] = '<img src="data:image/jpg;base64,';
|
||||||
|
$row_interface['chart'] .= graphic_combined_module(
|
||||||
|
array_values($interface['traffic']),
|
||||||
|
$params,
|
||||||
|
$params_combined
|
||||||
|
);
|
||||||
|
$row_interface['chart'] .= '" />';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -4572,18 +4583,28 @@ function reporting_projection_graph(
|
|||||||
'server_id' => $id_meta,
|
'server_id' => $id_meta,
|
||||||
'height' => $config['graph_image_height'],
|
'height' => $config['graph_image_height'],
|
||||||
'landscape' => $content['landscape'],
|
'landscape' => $content['landscape'],
|
||||||
|
'return_img_base_64' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
$params_combined = [
|
$params_combined = [
|
||||||
'projection' => $content['top_n_value'],
|
'projection' => $content['top_n_value'],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if ($pdf === true) {
|
||||||
|
$return['chart'] = '<img src="data:image/jpg;base64,';
|
||||||
|
$return['chart'] .= graphic_combined_module(
|
||||||
|
[$content['id_agent_module']],
|
||||||
|
$params,
|
||||||
|
$params_combined
|
||||||
|
);
|
||||||
|
$return['chart'] .= '" />';
|
||||||
|
} else {
|
||||||
$return['chart'] = graphic_combined_module(
|
$return['chart'] = graphic_combined_module(
|
||||||
[$content['id_agent_module']],
|
[$content['id_agent_module']],
|
||||||
$params,
|
$params,
|
||||||
$params_combined
|
$params_combined
|
||||||
);
|
);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'data':
|
case 'data':
|
||||||
@ -4830,6 +4851,7 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||||||
'height' => $config['graph_image_height'],
|
'height' => $config['graph_image_height'],
|
||||||
'fullscale' => true,
|
'fullscale' => true,
|
||||||
'landscape' => $content['landscape'],
|
'landscape' => $content['landscape'],
|
||||||
|
'return_img_base_64' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
@ -4895,7 +4917,12 @@ function reporting_value($report, $content, $type, $pdf=false)
|
|||||||
];
|
];
|
||||||
|
|
||||||
if ($content['visual_format'] != 1) {
|
if ($content['visual_format'] != 1) {
|
||||||
|
if ($only_image === false) {
|
||||||
$graph = grafico_modulo_sparse($params);
|
$graph = grafico_modulo_sparse($params);
|
||||||
|
} else {
|
||||||
|
$graph = '<img src="data:image/jpg;base64,'.grafico_modulo_sparse($params).'" />';
|
||||||
|
}
|
||||||
|
|
||||||
$return['data'][] = ['value' => $graph];
|
$return['data'][] = ['value' => $graph];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7608,6 +7635,7 @@ function reporting_custom_graph(
|
|||||||
'server_id' => $id_meta,
|
'server_id' => $id_meta,
|
||||||
'height' => $config['graph_image_height'],
|
'height' => $config['graph_image_height'],
|
||||||
'landscape' => $content['landscape'],
|
'landscape' => $content['landscape'],
|
||||||
|
'return_img_base_64' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
$params_combined = [
|
$params_combined = [
|
||||||
@ -7620,12 +7648,21 @@ function reporting_custom_graph(
|
|||||||
'labels' => $content['style']['label'],
|
'labels' => $content['style']['label'],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if ($pdf === true) {
|
||||||
|
$return['chart'] = '<img src="data:image/jpg;base64,';
|
||||||
|
$return['chart'] .= graphic_combined_module(
|
||||||
|
$modules,
|
||||||
|
$params,
|
||||||
|
$params_combined
|
||||||
|
);
|
||||||
|
$return['chart'] .= '" />';
|
||||||
|
} else {
|
||||||
$return['chart'] = graphic_combined_module(
|
$return['chart'] = graphic_combined_module(
|
||||||
$modules,
|
$modules,
|
||||||
$params,
|
$params,
|
||||||
$params_combined
|
$params_combined
|
||||||
);
|
);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'data':
|
case 'data':
|
||||||
@ -7789,9 +7826,14 @@ function reporting_simple_graph(
|
|||||||
'server_id' => $id_meta,
|
'server_id' => $id_meta,
|
||||||
'height' => $config['graph_image_height'],
|
'height' => $config['graph_image_height'],
|
||||||
'landscape' => $content['landscape'],
|
'landscape' => $content['landscape'],
|
||||||
|
'return_img_base_64' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if ($only_image === false) {
|
||||||
$return['chart'] = grafico_modulo_sparse($params);
|
$return['chart'] = grafico_modulo_sparse($params);
|
||||||
|
} else {
|
||||||
|
$return['chart'] = '<img src="data:image/jpg;base64,'.grafico_modulo_sparse($params).'" />';
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'data':
|
case 'data':
|
||||||
|
@ -778,9 +778,14 @@ function flot_slicesbar_graph(
|
|||||||
'ttl' => 1,
|
'ttl' => 1,
|
||||||
'widgets' => $widgets,
|
'widgets' => $widgets,
|
||||||
'show' => $show,
|
'show' => $show,
|
||||||
|
'return_img_base_64' => true,
|
||||||
];
|
];
|
||||||
|
|
||||||
return generator_chart_to_pdf('slicebar', $params);
|
$graph = '<img src="data:image/jpg;base64,';
|
||||||
|
$graph .= generator_chart_to_pdf('slicebar', $params);
|
||||||
|
$graph .= '" />';
|
||||||
|
|
||||||
|
return $graph;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a unique identifier to graph
|
// Get a unique identifier to graph
|
||||||
|
@ -94,7 +94,8 @@ page.onCallback = function() {
|
|||||||
if (!base_64) {
|
if (!base_64) {
|
||||||
page.render(output_filename, { format: "png" });
|
page.render(output_filename, { format: "png" });
|
||||||
} else {
|
} else {
|
||||||
var base64 = page.renderBase64("png");
|
page.settings.loadImages = false;
|
||||||
|
var base64 = page.renderBase64("jpg");
|
||||||
// do not remove this console.output
|
// do not remove this console.output
|
||||||
console.log(base64);
|
console.log(base64);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user