Fixed image modules historic report

This commit is contained in:
Luis 2020-06-22 11:20:26 +02:00 committed by Daniel Rodriguez
parent 01c72e09b4
commit bbf6fe8beb
2 changed files with 37 additions and 8 deletions

View File

@ -2142,10 +2142,24 @@ function reporting_html_historical_data($table, $item, $pdf=0)
$table1->data = [];
foreach ($item['data'] as $data) {
if (!is_numeric($data[__('Data')])) {
$row = [
$data[__('Date')],
$data[__('Data')],
];
if (is_snapshot_data($data[__('Data')])) {
if ($config['command_snapshot']) {
$row = [
$data[__('Date')],
'<img style="width:300px" src="'.io_safe_input($data[__('Data')]).'"></a>',
];
} else {
$row = [
$data[__('Date')],
wordwrap(io_safe_input($data[__('Data')]), 60, "<br>\n", true),
];
}
} else {
$row = [
$data[__('Date')],
$data[__('Data')],
];
}
} else {
$row = [
$data[__('Date')],
@ -2191,6 +2205,8 @@ function reporting_html_historical_data($table, $item, $pdf=0)
*/
function reporting_html_database_serialized($table, $item, $pdf=0)
{
global $config;
$table1 = new stdClass();
$table1->width = '100%';
$table1->head = [
@ -2205,9 +2221,19 @@ function reporting_html_database_serialized($table, $item, $pdf=0)
$table1->data = [];
foreach ($item['data'] as $data) {
foreach ($data['data'] as $data_unserialied) {
foreach ($data['data'] as $data_unserialized) {
$row = [$data['date']];
$row = array_merge($row, $data_unserialied);
foreach ($data_unserialized as $key => $data_value) {
if (is_snapshot_data($data_unserialized[$key])) {
if ($config['command_snapshot']) {
$data_unserialized[$key] = '<img style="width:300px" src="'.io_safe_input($data_value).'"></a>';
} else {
$data_unserialized[$key] = wordwrap(io_safe_input($data_value), 60, "<br>\n", true);
}
}
}
$row = array_merge($row, $data_unserialized);
$table1->data[] = $row;
}
}

View File

@ -143,11 +143,14 @@ class ImageProcessor implements \Psr\Log\LoggerAwareInterface
}
$data = $this->mpdf->imageVars[$v[1]];
$file = md5($data);
}
if (preg_match('/data:image\/(gif|jpeg|png);base64,(.*)/', $file, $v)) {
if (preg_match('~data:image/(gif|jpeg|png);base64,(.*)~', $file, $v)) {
$type = $v[1];
$data = base64_decode($v[2]);
$encoded = $v[2];
$decoded = "";
$data = base64_decode(html_entity_decode($encoded));
$file = md5($data);
}