Index: /branches/2.0/include/ws_functions.inc.php
===================================================================
--- /branches/2.0/include/ws_functions.inc.php	(revision 4343)
+++ /branches/2.0/include/ws_functions.inc.php	(revision 4344)
@@ -990,23 +990,5 @@
 function add_file($file_path, $type, $original_sum, $file_sum)
 {
-  // resolve the $file_path depending on the $type
-  if ('thumb' == $type) {
-    $file_path = get_thumbnail_location(
-      array(
-        'path' => $file_path,
-        'tn_ext' => 'jpg',
-        )
-      );
-  }
-
-  if ('high' == $type) {
-    @include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
-    $file_path = get_high_location(
-      array(
-        'path' => $file_path,
-        'has_high' => 'true'
-        )
-      );
-  }
+  $file_path = file_path_for_type($file_path, $type);
 
   $upload_dir = dirname($file_path);
@@ -1502,4 +1484,88 @@
 }
 
+function ws_images_checkFiles($params, &$service)
+{
+  if (!is_admin() or is_adviser())
+  {
+    return new PwgError(401, 'Access denied');
+  }
+
+  // input parameters
+  //
+  // image_id
+  // thumbnail_sum
+  // file_sum
+  // high_sum
+
+  $params['image_id'] = (int)$params['image_id'];
+  if ($params['image_id'] <= 0)
+  {
+    return new PwgError(WS_ERR_INVALID_PARAM, "Invalid image_id");
+  }
+
+  $query = '
+SELECT
+    path
+  FROM '.IMAGES_TABLE.'
+  WHERE id = '.$params['image_id'].'
+;';
+  $result = pwg_query($query);
+  if (mysql_num_rows($result) == 0) {
+    return new PwgError(404, "image_id not found");
+  }
+  list($path) = mysql_fetch_row($result);
+
+  $ret = array();
+
+  foreach (array('thumb', 'file', 'high') as $type) {
+    $param_name = $type;
+    if ('thumb' == $type) {
+      $param_name = 'thumbnail';
+    }
+
+    if (isset($params[$param_name.'_sum'])) {
+      $type_path = file_path_for_type($path, $type);
+      if (!is_file($type_path)) {
+        $ret[$param_name] = 'missing';
+      }
+      else {
+        if (md5_file($type_path) != $params[$param_name.'_sum']) {
+          $ret[$param_name] = 'differs';
+        }
+        else {
+          $ret[$param_name] = 'equals';
+        }
+      }
+    }
+  }
+
+  return $ret;
+}
+
+function file_path_for_type($file_path, $type='thumb')
+{
+  // resolve the $file_path depending on the $type
+  if ('thumb' == $type) {
+    $file_path = get_thumbnail_location(
+      array(
+        'path' => $file_path,
+        'tn_ext' => 'jpg',
+        )
+      );
+  }
+
+  if ('high' == $type) {
+    @include_once(PHPWG_ROOT_PATH.'include/functions_picture.inc.php');
+    $file_path = get_high_location(
+      array(
+        'path' => $file_path,
+        'has_high' => 'true'
+        )
+      );
+  }
+
+  return $file_path;
+}
+
 function ws_images_setInfo($params, &$service)
 {
Index: /branches/2.0/tools/piwigo_remote.pl
===================================================================
--- /branches/2.0/tools/piwigo_remote.pl	(revision 4343)
+++ /branches/2.0/tools/piwigo_remote.pl	(revision 4344)
@@ -18,4 +18,5 @@
 use JSON;
 use LWP::UserAgent;
+# LWP::Debug::level('+');
 use Getopt::Long;
 use Encode qw/is_utf8 decode/;
@@ -41,4 +42,5 @@
 
 our $ua = LWP::UserAgent->new;
+$ua->agent('Mozilla/piwigo_remote.pl 1.25');
 $ua->cookie_jar({});
 
@@ -56,4 +58,9 @@
     $conf{$conf_key} = defined $opt{$conf_key} ? $opt{$conf_key} : $conf_default{$conf_key}
 }
+
+$ua->default_headers->authorization_basic(
+    $conf{username},
+    $conf{password}
+);
 
 my $result = undef;
@@ -79,5 +86,4 @@
     use MIME::Base64 qw(encode_base64);
     use Digest::MD5::File qw/file_md5_hex/;
-    use File::Slurp;
 
     $form = {};
@@ -133,4 +139,5 @@
     }
     else {
+        print Dumper($response);
         warn 'A problem has occured during upload', "\n";
         warn $response->decoded_content, "\n";
@@ -171,4 +178,5 @@
 
     $result = $ua->get($query);
+    print Dumper($result);
     my $tags = from_json($result->content)->{result}{tags};
 
@@ -235,4 +243,35 @@
 }
 
+if ($opt{action} eq 'pwg.images.checkFiles') {
+    use Digest::MD5::File qw/file_md5_hex/;
+
+    $form = {};
+    $form->{method} = $opt{action};
+
+    foreach my $type (qw/thumbnail file high/) {
+        if (defined $opt{$type}) {
+            $form->{$type.'_sum'} = file_md5_hex($opt{$type});
+        }
+    }
+
+    foreach my $key (keys %{ $opt{define} }) {
+        $form->{$key} = $opt{define}{$key};
+    }
+
+    my $response = $ua->post(
+        $conf{base_url}.'/ws.php?format=json',
+        $form
+    );
+
+    print "-" x 50, "\n";
+    printf("response code    : %u\n", $response->code);
+    printf("response message : %s\n", $response->message);
+    print "-" x 50, "\n";
+    print "\n";
+
+    use Data::Dumper;
+    print Dumper(from_json($response->content));
+}
+
 if ($opt{action} eq 'pwg.images.setInfo' or $opt{action} eq 'pwg.categories.setInfo') {
     $form = {
@@ -254,4 +293,25 @@
 }
 
+if ($opt{action} eq 'pwg.categories.getList') {
+    $form = {
+        method => $opt{action},
+    };
+
+    foreach my $key (keys %{ $opt{define} }) {
+        $form->{$key} = $opt{define}{$key};
+    }
+
+    my $response = $ua->post(
+        $conf{base_url}.'/ws.php?format=json',
+        $form
+    );
+
+    use Data::Dumper;
+    print Dumper($response->content);
+    print Dumper(from_json($response->content)->{result});
+    print Dumper($response);
+}
+
+
 $query = pwg_ws_get_query(
     method => 'pwg.session.logout'
@@ -273,4 +333,6 @@
 sub send_chunks {
     my %params = @_;
+
+    use File::Slurp;
 
     my $content = read_file($params{filepath});
Index: /branches/2.0/ws.php
===================================================================
--- /branches/2.0/ws.php	(revision 4343)
+++ /branches/2.0/ws.php	(revision 4344)
@@ -252,4 +252,16 @@
 
   $service->addMethod(
+    'pwg.images.checkFiles',
+    'ws_images_checkFiles',
+    array(
+      'image_id' => array(),
+      'thumbnail_sum' => array('default' => null),
+      'file_sum' => array('default' => null),
+      'high_sum' => array('default' => null),
+      ),
+    'check if you have updated version of your files for a given photo, for each requested file type, the answer can be "missing", "equals" or "differs"'
+    );
+
+  $service->addMethod(
     'pwg.images.setInfo',
     'ws_images_setInfo',
