aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include
diff options
context:
space:
mode:
authorpatdenice <patdenice@piwigo.org>2010-04-24 22:22:32 +0000
committerpatdenice <patdenice@piwigo.org>2010-04-24 22:22:32 +0000
commit8a1b7a4e5fcafac9b769f9182804e378d59ad3ff (patch)
treecf1f6bffe2718633408fae3ba899f504b61d8a36 /admin/include
parent9ffeaaf2c8d913b41cfcf1ce96a475b53d4c045a (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/include')
-rw-r--r--admin/include/functions_upload.inc.php18
1 files changed, 15 insertions, 3 deletions
diff --git a/admin/include/functions_upload.inc.php b/admin/include/functions_upload.inc.php
index 39259ad34..fa8944d70 100644
--- a/admin/include/functions_upload.inc.php
+++ b/admin/include/functions_upload.inc.php
@@ -17,6 +17,10 @@ include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
//
// 4) register in database
+// add default event handler for image and thumbnail resize
+add_event_handler('upload_image_resize', 'pwg_image_resize', EVENT_HANDLER_PRIORITY_NEUTRAL, 6);
+add_event_handler('upload_thumbnail_resize', 'pwg_image_resize', EVENT_HANDLER_PRIORITY_NEUTRAL, 6);
+
function add_uploaded_file($source_filepath, $original_filename=null, $categories=null, $level=null)
{
global $conf;
@@ -60,7 +64,8 @@ function add_uploaded_file($source_filepath, $original_filename=null, $categorie
rename($file_path, $high_path);
$high_infos = pwg_image_infos($high_path);
- pwg_image_resize(
+ trigger_event('upload_image_resize',
+ false,
$high_path,
$file_path,
$conf['upload_form_websize_maxwidth'],
@@ -75,7 +80,8 @@ function add_uploaded_file($source_filepath, $original_filename=null, $categorie
$thumb_dir = dirname($thumb_path);
prepare_directory($thumb_dir);
- pwg_image_resize(
+ trigger_event('upload_thumbnail_resize',
+ false,
$file_path,
$thumb_path,
$conf['upload_form_thumb_maxwidth'],
@@ -169,8 +175,14 @@ function need_resize($image_filepath, $max_width, $max_height)
return false;
}
-function pwg_image_resize($source_filepath, $destination_filepath, $max_width, $max_height, $quality)
+function pwg_image_resize($result, $source_filepath, $destination_filepath, $max_width, $max_height, $quality)
{
+ if ($result !== false)
+ {
+ //someone hooked us - so we skip
+ return $result;
+ }
+
if (!function_exists('gd_info'))
{
return false;