diff --git a/CImage.php b/CImage.php index 94f745d..d641411 100644 --- a/CImage.php +++ b/CImage.php @@ -296,8 +296,10 @@ class CImage $this->saveFolder = $dir; $this->cacheFileName = $dir . '/' . $src; + /* Allow readonly cache is_writable($this->saveFolder) or $this->raiseError('Target directory is not writable.'); + */ // Sanitize filename $this->cacheFileName = preg_replace('/^a-zA-Z0-9\.-_/', '', $this->cacheFileName); @@ -1462,6 +1464,9 @@ class CImage $this->setTarget($src, $base); } + is_writable($this->saveFolder) + or $this->raiseError('Target directory is not writable.'); + switch(strtolower($this->extension)) { case 'jpeg': diff --git a/README.md b/README.md index b0b95ac..59e06a5 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,7 @@ Revision history v0.5.x (latest) +* Cache-directory can now be readonly and serve all cached files, still failing when need to save files. #5 * Cache now uses same file extension as original image #37. * Can output image as json format using `json` #11.