Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions core/components/phpthumbof/model/phpthumbof.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ function __construct(modX &$modx, &$settings_cache, $options, $s3info = 0) {
if ($s3info) { // used by the cache cleaner class
$this->cacheimgRegex = '/^' . str_replace('/', '\/', $this->config['s3cachePath']) . '.+\.(?:[0-9a-f]{8}|[0-9a-f]{32})\.(?:jpe?g|png|gif)$/'; // for safety, only select images with a hash
}
$this->config['postHook'] = $modx->getOption('pthumb.post_hook', null, FALSE);
}
// these can't be cached
$this->config['debug'] = empty($options['debug']) ? FALSE : TRUE;
Expand Down Expand Up @@ -451,6 +452,13 @@ public function createThumbnail($src, $options) {
$this->config['newFilePermissions'] = octdec($this->modx->getOption('new_file_permissions', null, '0664'));
}
chmod($cacheKey, $this->config['newFilePermissions']); // make sure file permissions are correct

if ($this->config['postHook']) {
$result = $this->modx->runSnippet($this->config['postHook'], $output);
if (!empty($result) && is_string($result)) { // allow hook to return a message as string
$this->debugmsg($result);
}
}
}
}

Expand Down