1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-03-13 01:30:11 +01:00

feat: Gestione immagini nelle viste

This commit is contained in:
Beppe 2025-03-07 11:08:01 +01:00
parent 60349f586c
commit ab23acb15e
2 changed files with 23 additions and 0 deletions

View File

@ -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 = '<a href="'.$print_url.'" target="_blank"><i class="fa fa-2x fa-print"></i></a>';
}
// 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 = '<img src="'.$url.'" style="max-height: 80px; max-width:120px">';
}
}
// Icona
elseif (preg_match('/^icon_(.+?)$/', trim($field), $m)) {
$value = '<span class=\'badge text-black\' style=\'font-weight:normal;\' ><i class="'.$r[$field].'" title="'.$r['icon_title_'.$m[1]].'" ></i> <span>'.$r['icon_title_'.$m[1]].'</span></span>';

View File

@ -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'";