aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorpatdenice <patdenice@piwigo.org>2011-04-27 17:03:25 +0000
committerpatdenice <patdenice@piwigo.org>2011-04-27 17:03:25 +0000
commitd95ddb7c6146157418f7735995a2b43ef3d2c8fb (patch)
tree1ed4715f98e323345393602290d4a679efe295b3 /include
parentc3a0ff6b886463cebd3959bae07dd87726bff24c (diff)
feature:2284
Create a class to manipulate images. git-svn-id: http://piwigo.org/svn/trunk@10641 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--include/config_default.inc.php9
-rw-r--r--include/ws_functions.inc.php21
2 files changed, 22 insertions, 8 deletions
diff --git a/include/config_default.inc.php b/include/config_default.inc.php
index b5095e63f..94eb05b01 100644
--- a/include/config_default.inc.php
+++ b/include/config_default.inc.php
@@ -321,6 +321,15 @@ $conf['insensitive_case_logon'] = false;
// 'filename'
$conf['uniqueness_mode'] = 'md5sum';
+// Library used for image resizing. Value could be 'auto', 'imagick',
+// 'ext_imagick or 'gd'. If value is 'auto', library will be choosen in this
+// order. If choosen library is not available, another one will be picked up.
+$conf['image_library'] = 'auto';
+
+// If library used is external installation of ImageMagick ('ext_imagick'),
+// you can define imagemagick directory.
+$conf['ext_imagick_dir'] = '';
+
// +-----------------------------------------------------------------------+
// | metadata |
// +-----------------------------------------------------------------------+
diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php
index c706c7f75..c60e8241b 100644
--- a/include/ws_functions.inc.php
+++ b/include/ws_functions.inc.php
@@ -2688,6 +2688,7 @@ function ws_images_resize($params, &$service)
include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php');
+ include_once(PHPWG_ROOT_PATH.'admin/include/image.class.php');
if (!empty($params['image_id']))
{
@@ -2725,32 +2726,36 @@ SELECT id, path, tn_ext, has_high
{
prepare_directory(dirname($thumb_path));
- $result = trigger_event(
- 'upload_thumbnail_resize',
- false,
- $image_path,
+ $img = new pwg_image($image_path, $params['library']);
+
+ $result = $img->pwg_resize(
$thumb_path,
$params['maxwidth'],
$params['maxheight'],
$params['quality'],
+ $params['automatic_rotation'],
true,
get_boolean($params['crop']),
get_boolean($params['follow_orientation'])
);
+
+ $img->destroy();
}
elseif (file_exists($hd_path))
{
- $result = trigger_event(
- 'upload_image_resize',
- false,
- $hd_path,
+ $img = new pwg_image($hd_path);
+
+ $result = $img->pwg_resize(
$image_path,
$params['maxwidth'],
$params['maxheight'],
$params['quality'],
+ $params['automatic_rotation'],
false
);
+ $img->destroy();
+
if (!empty($image['has_high']))
{
$conf['use_exif'] = false;