diff options
author | patdenice <patdenice@piwigo.org> | 2010-04-24 22:22:32 +0000 |
---|---|---|
committer | patdenice <patdenice@piwigo.org> | 2010-04-24 22:22:32 +0000 |
commit | 8a1b7a4e5fcafac9b769f9182804e378d59ad3ff (patch) | |
tree | cf1f6bffe2718633408fae3ba899f504b61d8a36 /admin/thumbnail.php | |
parent | 9ffeaaf2c8d913b41cfcf1ce96a475b53d4c045a (diff) |
Add triggers for image and thumbnail resizing.
git-svn-id: http://piwigo.org/svn/trunk@5957 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'admin/thumbnail.php')
-rw-r--r-- | admin/thumbnail.php | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/admin/thumbnail.php b/admin/thumbnail.php index b945fc7c2..06e14bd2a 100644 --- a/admin/thumbnail.php +++ b/admin/thumbnail.php @@ -32,10 +32,16 @@ check_status(ACCESS_ADMINISTRATOR); // RatioResizeImg creates a new picture (a thumbnail since it is supposed to // be smaller than original picture !) in the sub directory named // "thumbnail". -function RatioResizeImg($path, $newWidth, $newHeight, $tn_ext) +function RatioResizeImg($info, $path, $newWidth, $newHeight, $tn_ext) { global $conf, $lang, $page; + if ($info !== false) + { + //someone hooked us - so we skip + return $info; + } + if (!function_exists('gd_info')) { return; @@ -157,6 +163,9 @@ if (!function_exists('gd_info')) array_push($page['errors'], l10n('GD library is missing')); } +// add default event handler for thumbnail resize +add_event_handler('thumbnail_resize', 'RatioResizeImg', EVENT_HANDLER_PRIORITY_NEUTRAL, 5); + // +-----------------------------------------------------------------------+ // | template initialization | // +-----------------------------------------------------------------------+ @@ -251,7 +260,14 @@ if (isset($_POST['submit'])) } $starttime = get_moment(); - if ($info = RatioResizeImg($path,$_POST['width'],$_POST['height'],'jpg')) + if ($info = trigger_event('thumbnail_resize', + false, + $path, + $_POST['width'], + $_POST['height'], + 'jpg' + ) + ) { $endtime = get_moment(); $info['time'] = ($endtime - $starttime) * 1000; |