diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index cc7a3a3d4ce..4cf3b8e1c36 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -2632,7 +2632,7 @@ class Product extends CommonObject
if (! utf8_check($file)) $file=utf8_encode($file); // To be sure file is stored in UTF8 in memory
- if (dol_is_file($dir.$file) && preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$dir.$file))
+ if (dol_is_file($dir.$file) && preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i', $dir.$file))
{
$nbphoto++;
$photo = $file;
@@ -2641,8 +2641,8 @@ class Product extends CommonObject
if ($size == 1) { // Format vignette
// On determine nom du fichier vignette
$photo_vignette='';
- if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$photo,$regs)) {
- $photo_vignette=preg_replace('/'.$regs[0].'/i','',$photo)."_small".$regs[0];
+ if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i', $photo, $regs)) {
+ $photo_vignette=preg_replace('/'.$regs[0].'/i', '', $photo)."_small".$regs[0];
if (! dol_is_file($dirthumb.$photo_vignette)) $photo_vignette='';
}
@@ -2677,7 +2677,7 @@ class Product extends CommonObject
{
$return.= '
';
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
- if ($photo_vignette && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i',$photo) && ($product->imgWidth > $maxWidth || $product->imgHeight > $maxHeight))
+ if ($photo_vignette && preg_match('/(\.bmp|\.gif|\.jpg|\.jpeg|\.png)$/i', $photo) && ($product->imgWidth > $maxWidth || $product->imgHeight > $maxHeight))
{
$return.= ''.img_picto($langs->trans('GenerateThumb'),'refresh').' ';
}
@@ -2764,16 +2764,16 @@ class Product extends CommonObject
while (($file = readdir($handle)) != false)
{
if (! utf8_check($file)) $file=utf8_encode($file); // readdir returns ISO
- if (dol_is_file($dir.$file))
+ if (dol_is_file($dir.$file) && preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i', $dir.$file))
{
$nbphoto++;
// On determine nom du fichier vignette
$photo=$file;
$photo_vignette='';
- if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i',$photo,$regs))
+ if (preg_match('/(\.jpg|\.bmp|\.gif|\.png|\.tiff)$/i', $photo, $regs))
{
- $photo_vignette=preg_replace('/'.$regs[0].'/i','',$photo).'_small'.$regs[0];
+ $photo_vignette=preg_replace('/'.$regs[0].'/i', '', $photo).'_small'.$regs[0];
}
$dirthumb = $dir.'thumbs/';