aboutsummaryrefslogtreecommitdiffstats
path: root/tools/piwigo_remote.pl
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2009-01-08 23:33:35 +0000
committerplegall <plg@piwigo.org>2009-01-08 23:33:35 +0000
commit83275fd03618ec8891283c056d323f6bd398a831 (patch)
tree2d3de321da81dc6123afb7705ebb2e46d7007b03 /tools/piwigo_remote.pl
parentff0dfb9d7436ae0b91ed05a916aa17af9a19b8c0 (diff)
merge r3064 from branch 2.0 to trunk
bug 912 fixed: we need an extra original_sum to pwg.images.add API method to check photo existence. Using the file_sum was a bad idea. git-svn-id: http://piwigo.org/svn/trunk@3065 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'tools/piwigo_remote.pl')
-rw-r--r--tools/piwigo_remote.pl8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/piwigo_remote.pl b/tools/piwigo_remote.pl
index a0e876fac..3a9a2d92b 100644
--- a/tools/piwigo_remote.pl
+++ b/tools/piwigo_remote.pl
@@ -11,7 +11,7 @@ use Encode qw/is_utf8 decode/;
my %opt = ();
GetOptions(
\%opt,
- qw/action=s file=s thumbnail=s high=s categories=s define=s%/
+ qw/action=s file=s thumbnail=s high=s original=s categories=s define=s%/
);
our $ua = LWP::UserAgent->new;
@@ -48,6 +48,8 @@ if ($opt{action} eq 'pwg.images.add') {
use Digest::MD5::File qw/file_md5_hex/;
use File::Slurp;
+ my $original_sum = file_md5_hex($opt{original});
+
my $file_content = encode_base64(read_file($opt{file}));
my $file_sum = file_md5_hex($opt{file});
@@ -56,6 +58,7 @@ if ($opt{action} eq 'pwg.images.add') {
$form = {
method => 'pwg.images.add',
+ original_sum => $original_sum,
file_sum => $file_sum,
file_content => $file_content,
thumbnail_sum => $thumbnail_sum,
@@ -84,7 +87,8 @@ if ($opt{action} eq 'pwg.images.add') {
print "\n";
# use Data::Dumper;
-# print Dumper($response);
+# print Dumper($response->content);
+# print Dumper(from_json($response->content));
if ($response->is_success) {
print "upload successful\n";