diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 215e729a278..b9c4239d4dc 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -1457,10 +1457,13 @@ class FormFile if ($modulepart == 'medias' && !GETPOST('website')) { $moreparaminurl .= '&backtourl='.urlencode(DOL_URL_ROOT.'/ecm/index_medias.php?file_manager=1&modulepart='.$modulepart.'§ion_dir='.$relativepath); } - if ($modulepart == 'medias' && !GETPOST('website')) { - print ''.img_picto('', 'images', 'class="flip marginrightonly"').''; - } elseif ($modulepart == 'medias' && GETPOST('website')) { - print ''.img_picto('', 'images', 'class="flip marginrightonly"').''; + // Link to convert into webp + if (!preg_match('/\.webp$/i', $file['name'])) { + if ($modulepart == 'medias' && !GETPOST('website')) { + print ''.img_picto('', 'images', 'class="flip marginrightonly"').''; + } elseif ($modulepart == 'medias' && GETPOST('website')) { + print ''.img_picto('', 'images', 'class="flip marginrightonly"').''; + } } } } diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index da73f5cd4b6..01bad2e8f44 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -92,7 +92,7 @@ if ($module == 'ecm') { print ''; } if ($permtoadd && GETPOSTISSET('website')) { // If on file manager to manage medias of a web site - print 'ref.'" class="inline-block valignmiddle toolbarbutton paddingtop" title="'.dol_escape_htmltag($langs->trans("GenerateImgWebp")).'">'; + print 'ref).'" class="inline-block valignmiddle toolbarbutton paddingtop" title="'.dol_escape_htmltag($langs->trans("GenerateImgWebp")).'">'; print img_picto('', 'images', '', false, 0, 0, '', 'size15x flip marginrightonly'); print ''; } elseif ($permtoadd && $module == 'ecm') { // If on file manager medias in ecm @@ -205,7 +205,10 @@ if ($action == 'confirmconvertimgwebp') { if ($module == 'medias') { $formquestion['website']=array('type'=>'hidden', 'value'=>$website->ref, 'name'=>'website'); } - print $form->formconfirm($_SERVER["PHP_SELF"], empty($file) ? $langs->trans('ConfirmImgWebpCreation') : $langs->trans('ConfirmChosenImgWebpCreation'), empty($file) ? $langs->trans('ConfirmGenerateImgWebp') : $langs->trans('ConfirmGenerateChosenImgWebp'), 'convertimgwebp', $formquestion, "yes", 1); + $param = ''; + if (!empty($sortfield)) $param .= '&sortfield='.urlencode($sortfield); + if (!empty($sortorder)) $param .= '&sortorder='.urlencode($sortorder); + print $form->formconfirm($_SERVER["PHP_SELF"].($param ? '?'.$param : ''), empty($file) ? $langs->trans('ConfirmImgWebpCreation') : $langs->trans('ConfirmChosenImgWebpCreation'), empty($file) ? $langs->trans('ConfirmGenerateImgWebp') : $langs->trans('ConfirmGenerateChosenImgWebp'), 'convertimgwebp', $formquestion, "yes", 1); $action = 'file_manager'; } diff --git a/htdocs/langs/en_US/ecm.lang b/htdocs/langs/en_US/ecm.lang index 2e88812681d..4ef0bb2f0b9 100644 --- a/htdocs/langs/en_US/ecm.lang +++ b/htdocs/langs/en_US/ecm.lang @@ -48,7 +48,7 @@ GenerateImgWebp=Duplicate all images with another version with .webp format ConfirmGenerateImgWebp=If you confirm, you will generate an image in .webp format for all images currently into this folder (subfolders are not included)... ConfirmImgWebpCreation=Confirm all images duplication GenerateChosenImgWebp=Duplicate chosen image with another version with .webp format -ConfirmGenerateChosenImgWebp=If you confirm, you will generate an image in .webp format for chosen image +ConfirmGenerateChosenImgWebp=If you confirm, you will generate an image in .webp format for the image ConfirmChosenImgWebpCreation=Confirm chosen images duplication SucessConvertImgWebp=Images successfully duplicated SucessConvertChosenImgWebp=Chosen image successfully duplicated