Fix: missing images files filter
This commit is contained in:
parent
a13bf2b93f
commit
5c2d8656cc
@ -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.= '<br>';
|
||||
// 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.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&action=addthumb&file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').' </a>';
|
||||
}
|
||||
@ -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/';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user