From ab23acb15eaecf3583218930185ac640f4d92c9b Mon Sep 17 00:00:00 2001 From: Beppe Date: Fri, 7 Mar 2025 11:08:01 +0100 Subject: [PATCH] feat: Gestione immagini nelle viste --- ajax_dataload.php | 17 +++++++++++++++++ include/manager.php | 6 ++++++ 2 files changed, 23 insertions(+) diff --git a/ajax_dataload.php b/ajax_dataload.php index 2b8774cf6..9eb8fe4ff 100755 --- a/ajax_dataload.php +++ b/ajax_dataload.php @@ -21,6 +21,7 @@ include_once __DIR__.'/core.php'; use Util\Query; +use Models\Module; // Informazioni fondamentali $columns = (array) filter('columns', null, true); @@ -181,6 +182,22 @@ if (!empty($query)) { $value = ''; } + // Immagine + elseif ($field == '_img_') { + $module = Module::where('id', $id_module)->first(); + if( !empty($r['_img_']) ){ + $fileinfo = \Uploads::fileInfo($r['_img_']); + + $directory = '/'.$module->upload_directory.'/'; + $image = $directory.$r['_img_']; + $image_thumbnail = $directory.$fileinfo['filename'].'_thumb600.'.$fileinfo['extension']; + + $url = file_exists(base_dir().$image_thumbnail) ? base_path().$image_thumbnail : base_path().$image; + + $value = ''; + } + } + // Icona elseif (preg_match('/^icon_(.+?)$/', trim($field), $m)) { $value = ' '.$r['icon_title_'.$m[1]].''; diff --git a/include/manager.php b/include/manager.php index 843b17d81..1b9ebcf1a 100755 --- a/include/manager.php +++ b/include/manager.php @@ -121,6 +121,12 @@ if (!empty($type) && $type != 'menu' && $type != 'custom') { $attr_td .= " width='100'"; } + //Immagine + elseif (trim((string) $field) == '_img_') { + $attr_td .= " width='30'"; + $field = str_replace('_img_', '', $field); + } + // Icona di stampa elseif (trim((string) $field) == '_print_') { $attr_td .= " width='30'";