aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2012-01-17 00:11:14 +0000
committerplegall <plg@piwigo.org>2012-01-17 00:11:14 +0000
commitf7421e5789f6117ccab81ea53bf24d6cd77e95c7 (patch)
treefc93315aae6255732df8e6a83e6b26be1da79035 /admin
parenta7f39070f4dd3f568117f5ebc0c41c468abeae88 (diff)
feature 2548 (multiple sizes): adapt the web API method pwg.images.add (used
by pLoader, Digikam, Lightroom, iPhoto), pwg.images.checkFiles (pLoader only). The "resize" parameter was removed for pwg.images.add since this behavior becomes the default behavior in Piwigo 2.4. Just like pwg.images.addSimple, pwg.images.add now uses the add_uploaded_file function (next step is to merge pwg.images.add and pwg.images.addSimple) git-svn-id: http://piwigo.org/svn/trunk@12906 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/include/functions.php13
-rw-r--r--admin/include/functions_upload.inc.php25
2 files changed, 25 insertions, 13 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php
index f754f446a..1f09d69df 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -2307,4 +2307,17 @@ function clear_derivative_cache_rec($path, $pattern)
return $rmdir;
}
}
+
+function delete_element_derivatives($ids)
+{
+ // todo
+ if (!is_array($ids))
+ {
+ $ids = array($ids);
+ }
+
+ // for now I do a massive clear, to be removed once the function is
+ // properly implemented
+ clear_derivative_cache();
+}
?> \ No newline at end of file
diff --git a/admin/include/functions_upload.inc.php b/admin/include/functions_upload.inc.php
index da2e9b700..f53b2d09d 100644
--- a/admin/include/functions_upload.inc.php
+++ b/admin/include/functions_upload.inc.php
@@ -150,7 +150,7 @@ function save_upload_form_config($data, &$errors=array())
return false;
}
-function add_uploaded_file($source_filepath, $original_filename=null, $categories=null, $level=null, $image_id=null)
+function add_uploaded_file($source_filepath, $original_filename=null, $categories=null, $level=null, $image_id=null, $original_md5sum=null)
{
// 1) move uploaded file to upload/2010/01/22/20100122003814-449ada00.jpg
//
@@ -163,7 +163,15 @@ function add_uploaded_file($source_filepath, $original_filename=null, $categorie
global $conf, $user;
- $md5sum = md5_file($source_filepath);
+ if (isset($original_md5sum))
+ {
+ $md5sum = $original_md5sum;
+ }
+ else
+ {
+ $md5sum = md5_file($source_filepath);
+ }
+
$file_path = null;
if (isset($image_id))
@@ -234,7 +242,7 @@ SELECT
}
else
{
- copy($source_filepath, $file_path);
+ rename($source_filepath, $file_path);
}
if (pwg_image::get_library() != 'gd')
@@ -291,7 +299,6 @@ SELECT
$insert = array(
'file' => pwg_db_real_escape_string(isset($original_filename) ? $original_filename : basename($file_path)),
'date_available' => $dbnow,
- 'tn_ext' => 'jpg',
'path' => preg_replace('#^'.preg_quote(PHPWG_ROOT_PATH).'#', '', $file_path),
'filesize' => $file_infos['filesize'],
'width' => $file_infos['width'],
@@ -299,15 +306,7 @@ SELECT
'md5sum' => $md5sum,
'added_by' => $user['id'],
);
-
- if (isset($high_infos))
- {
- $insert['has_high'] = 'true';
- $insert['high_filesize'] = $high_infos['filesize'];
- $insert['high_width'] = $high_infos['width'];
- $insert['high_height'] = $high_infos['height'];
- }
-
+
if (isset($level))
{
$insert['level'] = $level;