diff --git a/htdocs/admin/company.php b/htdocs/admin/company.php index e3b07183c1b..7240239111e 100644 --- a/htdocs/admin/company.php +++ b/htdocs/admin/company.php @@ -538,7 +538,7 @@ if (!empty($mysoc->logo_small)) { print ''; if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_small)) { print '
'; - print ''; + print ''; print '
'; } elseif (!empty($mysoc->logo)) { if (!file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) { @@ -546,18 +546,18 @@ if (!empty($mysoc->logo_small)) { } $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$mysoc->logo, $maxwidthmini, $maxheightmini, '_small', $quality); print '
'; - print ''; + print ''; print '
'; } } elseif (!empty($mysoc->logo)) { if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo)) { print '
'; - print ''; + print ''; print '
'; print '
'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'
'; } else { print '
'; - print ''; + print ''; print '
'; } } @@ -580,7 +580,7 @@ if (!empty($mysoc->logo_squarred_small)) { print ''; if (file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_small)) { print '
'; - print ''; + print ''; print '
'; } elseif (!empty($mysoc->logo_squarred)) { if (!file_exists($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) { @@ -588,19 +588,22 @@ if (!empty($mysoc->logo_squarred_small)) { } $imgThumbSmall = vignette($conf->mycompany->dir_output.'/logos/'.$mysoc->logo_squarred, $maxwidthmini, $maxheightmini, '_small', $quality); print '
'; - print ''; + print ''; print '
'; } + print imgAddEditDeleteButton("logosquarred", '', $_SERVER["PHP_SELF"].'?action=removelogosquarred&token='.newToken()); } elseif (!empty($mysoc->logo_squarred)) { if (file_exists($conf->mycompany->dir_output.'/logos/'.$mysoc->logo_squarred)) { print '
'; - print ''; + print ''; print '
'; print '
'.img_delete($langs->trans("Delete"), '', 'marginleftonly').'
'; + print imgAddEditDeleteButton("logosquarred", '', $_SERVER["PHP_SELF"].'?action=removelogosquarred&token='.newToken()); } else { print '
'; - print ''; + print ''; print '
'; + print imgAddEditDeleteButton("logosquarred", '', ''); } } print ''; diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 7ead45f44e6..1960730c938 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -1,4 +1,6 @@ * Copyright (C) 2005-2007 Regis Houssin * Copyright (C) 2024 MDW @@ -515,7 +517,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', { require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; - global $conf, $langs; + global $langs; dol_syslog("vignette file=".$file." extName=".$extName." maxWidth=".$maxWidth." maxHeight=".$maxHeight." quality=".$quality." outdir=".$outdir." targetformat=".$targetformat); @@ -814,3 +816,18 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName = '_small', return $imgThumbName; } + + +/** + * Beautify an image by adding a link edit and delete on image + * + * @param string $htmlid ID of HTML img tag + * @param string $urledit URL to submit to edit Image + * @param string $urldelete URL to call when deleting the image + * @return string HTML and JS code to manage the update/delete of image. + */ +function imgAddEditDeleteButton($htmlid, $urledit, $urldelete) +{ + // TODO + return ''; +}