Skip to content

Commit

Permalink
[1.3.x] Updated Imagine plugin with enhancements
Browse files Browse the repository at this point in the history
[1.3.x] Updated Imagine plugin with enhancements

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | -
| Fixed tickets | zikula#2174, zikula#1644
| 1.4 PR        | in progress
| Refs tickets  | zikula#2170
| License       | LGPLv3+
| Doc PR        | -

- Imagine vendor plugin is updated to 0.6.2 (nov2014) from 0.3.0 (2012)
- added width/height autoscale as option in thumbnail generation
- added jpeg_quality/png_compression_level to preset options
- added modulename setting to preset option
- added option to force remove all thumbnails next to thumb cleanup
- updated README and thumb plugin descriptions
- updated CHANGELOG
  • Loading branch information
espaan committed Feb 6, 2015
1 parent 3e7e0cc commit e89f3ac
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/plugins/Imagine/Plugin.php
Expand Up @@ -113,7 +113,12 @@ public function cleanupThumbnails(Zikula_Event $event)
if ($event['modinfo']['name'] == 'Admin') {
// check thumb validity
$lastCleanup = new DateTime($this->getVar('last_cleanup'));
$nextCleanup = $lastCleanup->setTime(0,0,0)->add(new DateInterval('P1D'));
$thumb_auto_cleanup_period = $this->getVar('thumb_auto_cleanup_period', 'P1D');
try {
$nextCleanup = $lastCleanup->setTime(0,0,0)->add(new DateInterval($thumb_auto_cleanup_period));
} catch (Exception $exception) {
throw $exception;
}
$now = new DateTime('now');
if ($now > $nextCleanup) {
$this->setVar('last_cleanup', $now->setTime(0,0,0)->format('Y-m-d H:i:s'));
Expand Down Expand Up @@ -157,6 +162,7 @@ public function install()
*/
public function upgrade($oldVersion)
{

return true;
}

Expand All @@ -171,6 +177,7 @@ public function defaultSettings()
'version' => $this->getMetaVersion(),
'thumb_dir' => $this->getServiceId(),
'thumb_auto_cleanup' => false,
'thumb_auto_cleanup_period' => 'P1D',
'presets' => array(
'default' => new SystemPlugin_Imagine_Preset('default', array(
'width' => 100,
Expand Down

0 comments on commit e89f3ac

Please sign in to comment.