From 763e2a96a405a87ce7c1e2631c00c2ac96a7429e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 30 May 2012 00:05:42 +0200 Subject: [PATCH] Revert "Revert "Fix: Return empty image instead of error when file not found."" This reverts commit b99d3a70ae0b489f272cab31f282ce3ff62c5dff. --- htdocs/viewimage.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php index 83c0b3852e9..dc30fd53483 100644 --- a/htdocs/viewimage.php +++ b/htdocs/viewimage.php @@ -372,15 +372,15 @@ else // Open and return file // Output files on browser dol_syslog("viewimage.php return file $original_file content-type=$type"); - $original_file_osencoded=dol_osencode($original_file); - // This test if file exists should be useless. We keep it to find bug more easily - if (! dol_is_file($original_file_osencoded)) + // This test is to avoid error images when image is not available (for example thumbs). + if (! dol_is_file($original_file)) { - $error='Error: File '.$_GET["file"].' does not exists or filesystems permissions are not allowed'; + $original_file=DOL_DOCUMENT_ROOT.'/theme/common/nophoto.jpg'; + /*$error='Error: File '.$_GET["file"].' does not exists or filesystems permissions are not allowed'; dol_print_error(0,$error); print $error; - exit; + exit;*/ } // Les drois sont ok et fichier trouve @@ -395,6 +395,7 @@ else // Open and return file header('Content-type: image/png'); } + $original_file_osencoded=dol_osencode($original_file); readfile($original_file_osencoded); }