summaryrefslogtreecommitdiff
path: root/forum/utils/imagecache.php
diff options
context:
space:
mode:
authordeva <deva>2008-10-12 08:55:05 +0000
committerdeva <deva>2008-10-12 08:55:05 +0000
commit2fcc8a388b27747bb534f0beba18114720f9b899 (patch)
tree52fe5737c6f2c43982cfedb10f2f58db1dd84c9d /forum/utils/imagecache.php
parentb3bfcb9e6f512b2074dc69bf1af148ec4f4973d4 (diff)
Now files, forums and image cache create their storage dirs themselves, instead of createentities (when they do not already exists that is...)
Diffstat (limited to 'forum/utils/imagecache.php')
-rw-r--r--forum/utils/imagecache.php12
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));