Index: /trunk/ws.php
===================================================================
--- /trunk/ws.php	(revision 2634)
+++ /trunk/ws.php	(revision 2670)
@@ -181,4 +181,6 @@
       'thumbnail_content' => array(),
       'thumbnail_sum' => array(),
+      'high_content' => array('default' => null),
+      'high_sum' => array('default' => null),
       'name' => array('default' => null),
       'author' => array('default' => null),
Index: /trunk/tools/piwigo_remote.pl
===================================================================
--- /trunk/tools/piwigo_remote.pl	(revision 2634)
+++ /trunk/tools/piwigo_remote.pl	(revision 2670)
@@ -7,9 +7,10 @@
 use LWP::UserAgent;
 use Getopt::Long;
+use Encode qw/is_utf8 decode/;
 
 my %opt = ();
 GetOptions(
     \%opt,
-    qw/action=s file=s thumbnail=s categories=s define=s%/
+    qw/action=s file=s thumbnail=s high=s categories=s define=s%/
 );
 
@@ -62,4 +63,9 @@
         categories => $opt{categories},
     };
+
+    if (defined $opt{high}) {
+        $form->{high_content} = encode_base64(read_file($opt{high}));
+        $form->{high_sum} = file_md5_hex($opt{high});
+    }
 
     foreach my $key (keys %{ $opt{define} }) {
Index: /trunk/include/ws_functions.inc.php
===================================================================
--- /trunk/include/ws_functions.inc.php	(revision 2644)
+++ /trunk/include/ws_functions.inc.php	(revision 2670)
@@ -951,5 +951,5 @@
   $dumped_md5 = md5_file($file_path);
   if ($dumped_md5 != $params['file_sum']) {
-    return new PwgError(500, 'file transfert failed');
+    return new PwgError(500, 'file transfer failed');
   }
 
@@ -981,9 +981,40 @@
   $dumped_md5 = md5_file($thumbnail_path);
   if ($dumped_md5 != $params['thumbnail_sum']) {
-    return new PwgError(500, 'thumbnail transfert failed');
-  }
-
-  // fwrite($fh_log, 'output: '.md5_file($file_path)."\n");
-  // fwrite($fh_log, 'output: '.md5_file($thumbnail_path)."\n");
+    return new PwgError(500, 'thumbnail transfer failed');
+  }
+
+  // high resolution
+  if (isset($params['high_content']))
+  {
+    // high resolution directory is a subdirectory of the photo file, hard
+    // coded "pwg_high"
+    $high_dir = $upload_dir.'/pwg_high';
+    if (!is_dir($high_dir)) {
+      umask(0000);
+      mkdir($high_dir, 0777);
+    }
+
+    // high resolution path, same name as web size file
+    $high_path = sprintf(
+      '%s/%s.%s',
+      $high_dir,
+      $filename_wo_ext,
+      'jpg'
+      );
+
+    // dump the high resolution file
+    $fh_high = fopen($high_path, 'w');
+    fwrite($fh_high, base64_decode($params['high_content']));
+    fclose($fh_high);
+    chmod($high_path, 0644);
+
+    // check dumped thumbnail md5
+    $dumped_md5 = md5_file($high_path);
+    if ($dumped_md5 != $params['high_sum']) {
+      return new PwgError(500, 'high resolution transfer failed');
+    }
+
+    $high_filesize = floor(filesize($high_path)/1024);
+  }
 
   list($width, $height) = getimagesize($file_path);
@@ -1016,4 +1047,10 @@
       $insert[$key] = $params[$key];
     }
+  }
+
+  if (isset($params['high_content']))
+  {
+    $insert['has_high'] = 'true';
+    $insert['high_filesize'] = $high_filesize;
   }
 
