diff options
Diffstat (limited to 'forum/utils/imagecache.php')
-rw-r--r-- | forum/utils/imagecache.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/forum/utils/imagecache.php b/forum/utils/imagecache.php index aae5e66..ac3ebc3 100644 --- a/forum/utils/imagecache.php +++ b/forum/utils/imagecache.php @@ -40,6 +40,16 @@ function getCachedImage($filename) global $IMAGECACHE; $fullfilename = $IMAGECACHE . "/" . urlencode($filename); + // Test the storage dir + if(!file_exists($IMAGECACHE)) { + if(!mkdir($IMAGECACHE)) errorImage("Could not create directory: " . $IMAGECACHE); + } + if(!is_dir($IMAGECACHE)) errorImage($IMAGECACHE . " exists but is not a directory"); + if(!is_readable($IMAGECACHE) || !is_writeable($IMAGECACHE) || !is_executable($IMAGECACHE)) { + errorImage($IMAGECACHE . " exists but does not have the correct permissions. (r/w/x)"); + } + // end of dir test + if(!file_exists($fullfilename)) { $url = parse_url($filename); @@ -49,7 +59,7 @@ function getCachedImage($filename) error_reporting(E_ERROR | E_PARSE); - switch(tolower($filetype)) { + switch(strtolower($filetype)) { case ".jpeg": case ".jpg": $image = imagecreatefromjpeg(urldecode($filename)); |