diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php index 239369b2a1c1a0bebc61a400b7f9ef450d990ba0..565acd828b250f573500a8a9ac20b12f8a6ac0fc 100644 --- a/htdocs/core/class/html.formfile.class.php +++ b/htdocs/core/class/html.formfile.class.php @@ -863,11 +863,15 @@ class FormFile { $fileinfo = pathinfo($file['name']); print '<td align="center">'; - $minifile=$fileinfo['filename'].'_mini.'.strtolower($fileinfo['extension']); // Thumbs are created with filename in lower case if (image_format_supported($file['name']) > 0) { - print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])).'" class="aphoto" target="_blank">'; - print '<img border="0" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.'thumbs/'.$minifile).'" title="">'; + $minifile=getImageFileNameForSize($file['name'], '_mini', '.png'); // Thumbs are created with filename in lower case and with .png extension + //print $relativepath.'<br>'; + //print $file['path'].'/'.$minifile.'<br>'; + if (! dol_is_file($file['path'].'/'.$minifile)) $minifile=getImageFileNameForSize($file['name'], '_mini', '.'.$fileinfo['extension']); // For old thumbs + //print $file['path'].'/'.$minifile.'<br>'; + print '<a href="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.$fileinfo['filename'].'.'.strtolower($fileinfo['extension'])).'" class="aphoto" target="_blank">'; + print '<img border="0" height="'.$maxheightmini.'" src="'.DOL_URL_ROOT.'/viewimage.php?modulepart='.$modulepart.'&file='.urlencode($relativepath.$minifile).'" title="">'; print '</a>'; } else print ' '; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 4cac852a7adb36aed7c64c96feed19977158d119..c6256475592eff0b34dcfd784eeccb64b0fd138e 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1469,7 +1469,9 @@ function dol_add_file_process($upload_dir, $allowoverwrite=0, $donotupdatesessio // lowercase extension $info = pathinfo($destpath); $destpath = $info['dirname'].'/'.$info['filename'].'.'.strtolower($info['extension']); - + $info = pathinfo($destfile); + $destfile = $info['filename'].'.'.strtolower($info['extension']); + $resupload = dol_move_uploaded_file($TFile['tmp_name'][$i], $destpath, $allowoverwrite, 0, $TFile['error'][$i], 0, $varfiles); if (is_numeric($resupload) && $resupload > 0) { diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 20a58d7021c80f4486bd6f26f562e5a45e21534b..669da7b751bec355c55b7f38a99f296c3fcefc9c 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -301,7 +301,7 @@ function dol_imageResizeOrCrop($file, $mode, $newWidth, $newHeight, $src_x=0, $s * @param string $extName Extension to differenciate thumb file name ('_small', '_mini') * @param int $quality Quality of compression (0=worst, 100=best) * @param string $outdir Directory where to store thumb - * @param int $targetformat New format of target (1,2,3,... or 0 to keep old format) + * @param int $targetformat New format of target (IMAGETYPE_GIF, IMAGETYPE_JPG, IMAGETYPE_PNG, IMAGETYPE_BMP, IMAGETYPE_WBMP ... or 0 to keep old format) * @return string Full path of thumb or '' if it fails */ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $quality=50, $outdir='thumbs', $targetformat=0) @@ -473,6 +473,7 @@ function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $ } // Initialisation des variables selon l'extension de l'image + // $targetformat is 0 by default, in such case, we keep original extension switch($targetformat) { case IMAGETYPE_GIF: // 1 diff --git a/htdocs/core/modules/modStock.class.php b/htdocs/core/modules/modStock.class.php index 67bebc0d6d765e3e8c292a21c894915909c8efbd..81454a522220d7e315efb687056ae69fe4e115bf 100644 --- a/htdocs/core/modules/modStock.class.php +++ b/htdocs/core/modules/modStock.class.php @@ -189,13 +189,13 @@ class modStock extends DolibarrModules $this->import_icon[$r]=$this->picto; $this->import_entities_array[$r]=array(); // We define here only fields that use another icon that the one defined into import_icon $this->import_tables_array[$r]=array('ps'=>MAIN_DB_PREFIX.'product_stock'); - $this->import_fields_array[$r]=array('ps.fk_product'=>"Product*",'ps.fk_entrepot'=>"Warehouse*",'ps.reel'=>"Stock*",'ps.pmp'=>"PMP" ); + $this->import_fields_array[$r]=array('ps.fk_product'=>"Product*",'ps.fk_entrepot'=>"Warehouse*",'ps.reel'=>"Stock*"); $this->import_convertvalue_array[$r]=array( 'ps.fk_product'=>array('rule'=>'fetchidfromref','classfile'=>'/product/class/product.class.php','class'=>'Product','method'=>'fetch','element'=>'product'), 'ps.fk_entrepot'=>array('rule'=>'fetchidfromref','classfile'=>'/product/stock/class/entrepot.class.php','class'=>'Entrepot','method'=>'fetch','element'=>'label') ); - $this->import_examplevalues_array[$r]=array('ps.fk_product'=>"PREF123456",'ps.fk_entrepot'=>"ALM001",'ps.reel'=>"10",'ps.pmp'=>"25" + $this->import_examplevalues_array[$r]=array('ps.fk_product'=>"PREF123456",'ps.fk_entrepot'=>"ALM001",'ps.reel'=>"10" ); }