mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-22 17:31:25 +01:00
Merge branch '16.0' of git@github.com:Dolibarr/dolibarr.git into 17.0
This commit is contained in:
@@ -1714,10 +1714,16 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
|
||||
$resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destfull, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles, $upload_dir);
|
||||
|
||||
if (is_numeric($resupload) && $resupload > 0) { // $resupload can be 'ErrorFileAlreadyExists'
|
||||
global $maxwidthsmall, $maxheightsmall, $maxwidthmini, $maxheightmini;
|
||||
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php';
|
||||
|
||||
$tmparraysize = getDefaultImageSizes();
|
||||
$maxwidthsmall = $tmparraysize['maxwidthsmall'];
|
||||
$maxheightsmall = $tmparraysize['maxheightsmall'];
|
||||
$maxwidthmini = $tmparraysize['maxwidthmini'];
|
||||
$maxheightmini = $tmparraysize['maxheightmini'];
|
||||
//$quality = $tmparraysize['quality'];
|
||||
$quality = 50; // For thumbs, we force quality to 50
|
||||
|
||||
// Generate thumbs.
|
||||
if ($generatethumbs) {
|
||||
if (image_format_supported($destfull) == 1) {
|
||||
@@ -1725,10 +1731,10 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess
|
||||
// We can't use $object->addThumbs here because there is no $object known
|
||||
|
||||
// Used on logon for example
|
||||
$imgThumbSmall = vignette($destfull, $maxwidthsmall, $maxheightsmall, '_small', 50, "thumbs");
|
||||
$imgThumbSmall = vignette($destfull, $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs");
|
||||
// Create mini thumbs for image (Ratio is near 16/9)
|
||||
// Used on menu or for setup page for example
|
||||
$imgThumbMini = vignette($destfull, $maxwidthmini, $maxheightmini, '_mini', 50, "thumbs");
|
||||
$imgThumbMini = vignette($destfull, $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,12 +23,34 @@
|
||||
*/
|
||||
|
||||
// Define size of logo small and mini
|
||||
// TODO Remove this and call getDefaultImageSizes() instead
|
||||
$maxwidthsmall = 480;
|
||||
$maxheightsmall = 270; // Near 16/9eme
|
||||
$maxwidthmini = 128;
|
||||
$maxheightmini = 72; // 16/9eme
|
||||
$quality = 80;
|
||||
|
||||
/**
|
||||
* Return default values for image sizes
|
||||
*
|
||||
* @return array Array of default values
|
||||
*/
|
||||
function getDefaultImageSizes()
|
||||
{
|
||||
$maxwidthsmall = 480;
|
||||
$maxheightsmall = 270; // Near 16/9eme
|
||||
$maxwidthmini = 128;
|
||||
$maxheightmini = 72; // 16/9eme
|
||||
$quality = 80;
|
||||
|
||||
return array(
|
||||
'maxwidthsmall' => $maxwidthsmall,
|
||||
'maxheightsmall' => $maxheightsmall,
|
||||
'maxwidthmini' => $maxwidthmini,
|
||||
'maxheightmini' => $maxheightmini,
|
||||
'quality' => $quality
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if a filename is file name of a supported image format
|
||||
|
||||
Reference in New Issue
Block a user