From 1c80ae1ac9f742b3fee7f6aecaf50c538bafe1e4 Mon Sep 17 00:00:00 2001 From: Oliver Haase-Lobinger Date: Wed, 17 Oct 2012 21:51:27 +0300 Subject: [PATCH] Update core/components/phpthumbof/model/phpthumbof/phpthumbof.class.php Updating an image by just "overwriting" it had no effect because the phpThumbOf cache does not care about the date, only about the filename. With this little modification an image can easily be updated by overwriting it without any need to check on all the places this image was used (and refresh the cache for those). --- .../components/phpthumbof/model/phpthumbof/phpthumbof.class.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/components/phpthumbof/model/phpthumbof/phpthumbof.class.php b/core/components/phpthumbof/model/phpthumbof/phpthumbof.class.php index 416bdae..fb6e45b 100644 --- a/core/components/phpthumbof/model/phpthumbof/phpthumbof.class.php +++ b/core/components/phpthumbof/model/phpthumbof/phpthumbof.class.php @@ -289,6 +289,7 @@ public function getCacheFilename() { $inputSanitized = str_replace(array(':','/'),'_',$this->input); $this->cacheFilename = md5($inputSanitized); $this->cacheFilename .= '.'.md5(serialize($this->options)); + $this->cacheFilename .= '.'.filemtime(rtrim($this->modx->getOption('base_path',null,MODX_BASE_PATH),'/').$this->input); $this->cacheFilename .= '.' . (!empty($this->options['f']) ? $this->options['f'] : 'png'); } else { /* or attempt to preserve the filename */ $inputSanitized = str_replace(array('http://','https://','ftp://','sftp://'),'',$this->input); @@ -304,6 +305,7 @@ public function getCacheFilename() { } } $this->cacheFilename .= '.'.md5(serialize($this->options)).$this->modx->resource->get('id'); + $this->cacheFilename .= '.'.filemtime(rtrim($this->modx->getOption('base_path',null,MODX_BASE_PATH),'/').$this->input); $this->cacheFilename .= '.' . (!empty($this->options['f']) ? $this->options['f'] : 'png'); } }