From 08ee3064d0729b4406eaff82f50b43bc0baa9d61 Mon Sep 17 00:00:00 2001 From: Mikael Roos Date: Fri, 21 Nov 2014 22:31:04 +0100 Subject: [PATCH] * Cache-directory can now be readonly and serve all cached files, still failing when need to save files. #5 --- CImage.php | 5 +++++ README.md | 1 + 2 files changed, 6 insertions(+) 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.