Fix: missing images files filter
This commit is contained in:
parent
1c97934f6d
commit
454aa69697
@ -2618,7 +2618,7 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
if (! utf8_check($file)) $file=utf8_encode($file); // To be sure file is stored in UTF8 in memory
|
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++;
|
$nbphoto++;
|
||||||
$photo = $file;
|
$photo = $file;
|
||||||
@ -2627,8 +2627,8 @@ class Product extends CommonObject
|
|||||||
if ($size == 1) { // Format vignette
|
if ($size == 1) { // Format vignette
|
||||||
// On determine nom du fichier vignette
|
// On determine nom du fichier vignette
|
||||||
$photo_vignette='';
|
$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];
|
||||||
if (! dol_is_file($dirthumb.$photo_vignette)) $photo_vignette='';
|
if (! dol_is_file($dirthumb.$photo_vignette)) $photo_vignette='';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2663,7 +2663,7 @@ class Product extends CommonObject
|
|||||||
{
|
{
|
||||||
$return.= '<br>';
|
$return.= '<br>';
|
||||||
// On propose la generation de la vignette si elle n'existe pas et si la taille est superieure aux limites
|
// 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>';
|
$return.= '<a href="'.$_SERVER["PHP_SELF"].'?id='.$_GET["id"].'&action=addthumb&file='.urlencode($pdir.$viewfilename).'">'.img_picto($langs->trans('GenerateThumb'),'refresh').' </a>';
|
||||||
}
|
}
|
||||||
@ -2750,16 +2750,16 @@ class Product extends CommonObject
|
|||||||
while (($file = readdir($handle)) != false)
|
while (($file = readdir($handle)) != false)
|
||||||
{
|
{
|
||||||
if (! utf8_check($file)) $file=utf8_encode($file); // readdir returns ISO
|
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++;
|
$nbphoto++;
|
||||||
|
|
||||||
// On determine nom du fichier vignette
|
// On determine nom du fichier vignette
|
||||||
$photo=$file;
|
$photo=$file;
|
||||||
$photo_vignette='';
|
$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/';
|
$dirthumb = $dir.'thumbs/';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user