diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 36e8cef6bfe..25833df624f 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -148,10 +148,11 @@ function dol_getImageSize($file, $url = false) * @param int $src_x Position of croping image in source image (not use if mode=0) * @param int $src_y Position of croping image in source image (not use if mode=0) * @param string $filetowrite Path of file to write (overwrite source file if not provided) + * @param int $newquality Value for the new quality of image, for supported format (use 0 for maximum/unchanged). * @return string File name if OK, error message if KO * @see dol_convert_file() */ -function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, $src_y = 0, $filetowrite = '') +function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, $src_y = 0, $filetowrite = '', $newquality = 0) { require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php'; @@ -234,7 +235,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, case 2: // Jpg $img = imagecreatefromjpeg($filetoread); $extImg = '.jpg'; - $newquality = 100; // % quality maximum + $newquality = ($newquality ? $newquality : '100'); // % quality maximum break; case 3: // Png $img = imagecreatefrompng($filetoread); @@ -249,7 +250,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x = 0, case 18: // Webp $img = imagecreatefromwebp($filetoread); $extImg = '.webp'; - $newquality = '100'; // % quality maximum + $newquality = ($newquality ? $newquality : '100'); // % quality maximum break; } diff --git a/htdocs/core/tpl/filemanager.tpl.php b/htdocs/core/tpl/filemanager.tpl.php index 95ab58e4132..f06d1806fe2 100644 --- a/htdocs/core/tpl/filemanager.tpl.php +++ b/htdocs/core/tpl/filemanager.tpl.php @@ -71,7 +71,7 @@ print '
'; // Toolbar if ($permtoadd) { - $websitekeyandpageid = (!empty($websitekey) ? '&website='.$websitekey : '').(!empty($pageid) ? '&pageid='.$pageid : ''); + $websitekeyandpageid = (!empty($websitekey) ? '&website='.urlencode($websitekey) : '').(!empty($pageid) ? '&pageid='.urlencode($pageid) : ''); print ''; print img_picto('', 'folder-plus', '', false, 0, 0, '', 'size15x marginrightonly'); print ''; @@ -202,7 +202,7 @@ if ($action == 'convertimgwebp' && $permtoadd) { if (!(substr_compare($filepath, 'webp', -strlen('webp')) === 0)) { if (image_format_supported($filepath) == 1) { $filepathnoext = preg_replace("/\..*/", "", $filepath); - $result = dol_imageResizeOrCrop($filepath, 0, 0, 0, 0, 0, $filepathnoext.'.webp'); + $result = dol_imageResizeOrCrop($filepath, 0, 0, 0, 0, 0, $filepathnoext.'.webp', 90); if (!dol_is_file($result)) { $error++; setEventMessages($result, null, 'errors'); @@ -227,7 +227,7 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg print ''."\n"; print ''."\n"; print ''; - print ' '.$langs->trans("ECMSections"); + print ''.$langs->trans("ECMSections").''; print ''; $showonrightsize = ''; @@ -238,7 +238,7 @@ if (empty($action) || $action == 'editfile' || $action == 'file_manager' || preg if (!empty($conf->use_javascript_ajax) && empty($conf->global->MAIN_ECM_DISABLE_JS)) { // Show the link to "Root" if ($showroot) { - print '
'; + print '
'; if ($module == 'medias') { print $langs->trans("RootOfMedias"); } else {