Visual Console Refactor: improvements and fixes

Former-commit-id: c1a5f1ca26d719c7ed0291ec611e0e14e8f5c7b4
This commit is contained in:
Alejandro Gallardo Escobar 2019-04-22 13:09:34 +02:00
parent b93a016f50
commit 22ce005e5d
4 changed files with 17 additions and 19 deletions

View File

@ -223,12 +223,7 @@ final class Container extends Model
$backgroundImage = static::extractBackgroundImage($row); $backgroundImage = static::extractBackgroundImage($row);
if ($backgroundUrl === null && $backgroundImage !== null) { if ($backgroundUrl === null && $backgroundImage !== null) {
$backgroundUrl = ui_get_full_url( $backgroundPath = 'images/console/background/'.$backgroundImage;
'images/console/background/'.$backgroundImage,
false,
false,
false
);
$width = (int) $row['width']; $width = (int) $row['width'];
$height = (int) $row['height']; $height = (int) $row['height'];
@ -238,7 +233,7 @@ final class Container extends Model
'getFile' => 1, 'getFile' => 1,
'thumb' => 1, 'thumb' => 1,
'thumb_size' => $width.'x'.$height, 'thumb_size' => $width.'x'.$height,
'file' => $backgroundUrl, 'file' => '../../'.$backgroundPath,
]; ];
$row['backgroundURL'] = ui_get_full_url( $row['backgroundURL'] = ui_get_full_url(
'include/Image/image_functions.php?'.http_build_query($q), 'include/Image/image_functions.php?'.http_build_query($q),
@ -247,7 +242,12 @@ final class Container extends Model
false false
); );
} else { } else {
$row['backgroundURL'] = $backgroundUrl; $row['backgroundURL'] = ui_get_full_url(
$backgroundPath,
false,
false,
false
);
} }
} }

View File

@ -149,8 +149,9 @@ final class Group extends Item
// Get the status img src. // Get the status img src.
$groupId = static::extractGroupId($data); $groupId = static::extractGroupId($data);
$status = \groups_get_status($groupId); $status = \groups_get_status($groupId);
$imagePath = \visual_map_get_image_status_element($data, $status);
$data['statusImageSrc'] = \ui_get_full_url( $data['statusImageSrc'] = \ui_get_full_url(
\visual_map_get_image_status_element($data, $status), $imagePath,
false, false,
false, false,
false false
@ -159,7 +160,7 @@ final class Group extends Item
// If the width or the height are equal to 0 we will extract them // If the width or the height are equal to 0 we will extract them
// from the real image size. // from the real image size.
if ((int) $data['width'] === 0 || (int) $data['height'] === 0) { if ((int) $data['width'] === 0 || (int) $data['height'] === 0) {
$sizeImage = getimagesize($data['statusImageSrc']); $sizeImage = getimagesize($imagePath);
$data['width'] = $sizeImage[0]; $data['width'] = $sizeImage[0];
$data['height'] = $sizeImage[1]; $data['height'] = $sizeImage[1];
} }

View File

@ -112,17 +112,13 @@ final class Icon extends Item
include_once $config['homedir'].'/include/functions_visual_map.php'; include_once $config['homedir'].'/include/functions_visual_map.php';
// Get the img src. // Get the img src.
$data['imageSrc'] = \ui_get_full_url( $imagePath = \visual_map_get_image_status_element($data);
\visual_map_get_image_status_element($data), $data['imageSrc'] = \ui_get_full_url($imagePath, false, false, false);
false,
false,
false
);
// If the width or the height are equal to 0 we will extract them // If the width or the height are equal to 0 we will extract them
// from the real image size. // from the real image size.
if ((int) $data['width'] === 0 || (int) $data['height'] === 0) { if ((int) $data['width'] === 0 || (int) $data['height'] === 0) {
$sizeImage = getimagesize($data['imageSrc']); $sizeImage = getimagesize($imagePath);
$data['width'] = $sizeImage[0]; $data['width'] = $sizeImage[0];
$data['height'] = $sizeImage[1]; $data['height'] = $sizeImage[1];
} }

View File

@ -179,8 +179,9 @@ final class StaticGraph extends Item
} }
// Get the img src. // Get the img src.
$imagePath = \visual_map_get_image_status_element($data);
$data['statusImageSrc'] = \ui_get_full_url( $data['statusImageSrc'] = \ui_get_full_url(
\visual_map_get_image_status_element($data), $imagePath,
false, false,
false, false,
false false
@ -189,7 +190,7 @@ final class StaticGraph extends Item
// If the width or the height are equal to 0 we will extract them // If the width or the height are equal to 0 we will extract them
// from the real image size. // from the real image size.
if ((int) $data['width'] === 0 || (int) $data['height'] === 0) { if ((int) $data['width'] === 0 || (int) $data['height'] === 0) {
$sizeImage = getimagesize($data['statusImageSrc']); $sizeImage = getimagesize($imagePath);
$data['width'] = $sizeImage[0]; $data['width'] = $sizeImage[0];
$data['height'] = $sizeImage[1]; $data['height'] = $sizeImage[1];
} }