diff options
author | plegall <plg@piwigo.org> | 2010-03-01 16:22:34 +0000 |
---|---|---|
committer | plegall <plg@piwigo.org> | 2010-03-01 16:22:34 +0000 |
commit | 35694a636ef34dba5384e1a530b837208b9e55f9 (patch) | |
tree | 908cf4e3a7c02f82293bb78ace9155e6db360d59 /include | |
parent | 91a6b6a7363248b613bdb19fd310c5dc2a5dccf3 (diff) |
merge r5013 from branch 2.0 to trunk
feature 1448 added: ability to set the upload directory (for pwg.images.add
API method).
Warning: due to risk on img src construction, the upload_dir must be relative
to the Piwigo directory itself.
git-svn-id: http://piwigo.org/svn/trunk@5014 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r-- | include/config_default.inc.php | 3 | ||||
-rw-r--r-- | include/ws_functions.inc.php | 10 |
2 files changed, 10 insertions, 3 deletions
diff --git a/include/config_default.inc.php b/include/config_default.inc.php index 972d89ea5..96f89661a 100644 --- a/include/config_default.inc.php +++ b/include/config_default.inc.php @@ -759,4 +759,7 @@ $conf['light_slideshow'] = true; // the local data directory is used to store data such as compiled templates // or other plugin variables etc $conf['local_data_dir'] = dirname(dirname(__FILE__)).'/_data'; + +// where should the API add photos? +$conf['upload_dir'] = PHPWG_ROOT_PATH.'upload'; ?> diff --git a/include/ws_functions.inc.php b/include/ws_functions.inc.php index 20a70d936..8116a50b6 100644 --- a/include/ws_functions.inc.php +++ b/include/ws_functions.inc.php @@ -911,6 +911,8 @@ UPDATE '.IMAGES_TABLE.' function ws_images_add_chunk($params, &$service) { + global $conf; + ws_logfile('[ws_images_add_chunk] welcome'); // data // original_sum @@ -941,7 +943,7 @@ function ws_images_add_chunk($params, &$service) ); } - $upload_dir = PHPWG_ROOT_PATH.'upload/buffer'; + $upload_dir = $conf['upload_dir'].'/buffer'; // create the upload directory tree if not exists if (!is_dir($upload_dir)) { @@ -990,6 +992,8 @@ function ws_images_add_chunk($params, &$service) function merge_chunks($output_filepath, $original_sum, $type) { + global $conf; + ws_logfile('[merge_chunks] input parameter $output_filepath : '.$output_filepath); if (is_file($output_filepath)) @@ -1003,7 +1007,7 @@ function merge_chunks($output_filepath, $original_sum, $type) } } - $upload_dir = PHPWG_ROOT_PATH.'upload/buffer'; + $upload_dir = $conf['upload_dir'].'/buffer'; $pattern = '/'.$original_sum.'-'.$type.'/'; $chunks = array(); @@ -1230,7 +1234,7 @@ SELECT // upload directory hierarchy $upload_dir = sprintf( - PHPWG_ROOT_PATH.'upload/%s/%s/%s', + $conf['upload_dir'].'/%s/%s/%s', $year, $month, $day |