Merge branch 'ent-10917-iconos-de-so-personalizados-se-ven-rotos' into 'develop'

Ent 10917 iconos de so personalizados se ven rotos

See merge request artica/pandorafms!5707
This commit is contained in:
Daniel Rodriguez 2023-04-12 13:50:30 +00:00
commit 01e831312d
2 changed files with 33 additions and 1 deletions

View File

@ -116,6 +116,22 @@ function get_list_os_icons_dir()
}
}
$items2 = scandir($config['homedir'].'/images/os_icons');
foreach ($items2 as $item2) {
if (strstr($item2, '_small.png') || strstr($item2, '_small.gif')
|| strstr($item2, '_small.jpg')
) {
continue;
}
if (strstr($item2, '.png') || strstr($item2, '.gif')
|| strstr($item2, '.jpg')
) {
$return[$item2] = $item2;
}
}
return $return;
}
@ -124,10 +140,15 @@ function get_list_os_icons_dir()
<script type="text/javascript">
function show_icon_OS() {
var extension = $("#icon").val().split('.').pop();
var params = [];
params.push("get_image_path=1");
params.push('img_src=images/' + $("#icon").val());
if (extension !== 'svg') {
params.push('img_src=images/os_icons/' + $("#icon").val());
} else {
params.push('img_src=images/' + $("#icon").val());
}
params.push("page=include/ajax/skins.ajax");
jQuery.ajax ({
data: params.join ("&"),

View File

@ -876,6 +876,17 @@ function ui_print_os_icon(
$no_in_meta = (is_metaconsole() === false);
$icon = (string) db_get_value('icon_name', 'tconfig_os', 'id_os', (int) $id_os);
$extension = pathinfo($icon, PATHINFO_EXTENSION);
if (empty($extension) === true) {
$icon .= '.png';
}
if (empty($extension) === true || $extension === 'png'
|| $extension === 'jpg' || $extension === 'gif' && $subfolder === '.'
) {
$subfolder = 'os_icons';
}
$os_name = get_os_name($id_os);
if (empty($icon) === true) {
if ($only_src) {