From fedf1f3288addbc32ad6b0de1492058ceaea9ee5 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Fri, 22 Jan 2016 14:02:48 +0100 Subject: [PATCH] Fix view of product image when using old path Fix size of image uploaded on user. --- htdocs/core/lib/files.lib.php | 6 ++++-- htdocs/core/lib/functions.lib.php | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 73de2784427..8fc5bea72b6 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1127,6 +1127,8 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio if (is_numeric($resupload) && $resupload > 0) { include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; + global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini; + if (empty($donotupdatesession)) { include_once DOL_DOCUMENT_ROOT.'/core/class/html.formmail.class.php'; @@ -1137,10 +1139,10 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio { // Create small thumbs for image (Ratio is near 16/9) // Used on logon for example - $imgThumbSmall = vignette($destpath, 160, 120, '_small', 50, "thumbs"); + $imgThumbSmall = vignette($destpath, $maxwidthsmall, $maxheigthsmall, '_small', 50, "thumbs"); // Create mini thumbs for image (Ratio is near 16/9) // Used on menu or for setup page for example - $imgThumbMini = vignette($destpath, 160, 120, '_mini', 50, "thumbs"); + $imgThumbMini = vignette($destpath, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs"); } setEventMessage($langs->trans("FileTransferComplete")); diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 8c71b882d21..41a9d7c78b7 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -3762,7 +3762,9 @@ function get_exdir($num,$level,$alpha,$withoutslash,$object,$modulepart) $path = ''; - if (! empty($level) && in_array($modulepart, array('cheque','user','category','holiday','shipment', 'member','don','donation','supplier_invoice','invoice_supplier','mailing'))) + $arrayforoldpath=array('cheque','user','category','holiday','shipment', 'member','don','donation','supplier_invoice','invoice_supplier','mailing'); + if (! empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) $arrayforoldpath[]='product'; + if (! empty($level) && in_array($modulepart, $arrayforoldpath)) { // This part should be removed once all code is using "get_exdir" to forge path, with all parameters provided if (empty($alpha)) $num = preg_replace('/([^0-9])/i','',$num); -- GitLab