Changeset 2670
- Timestamp:
- Oct 5, 2008, 11:22:57 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/ws_functions.inc.php
r2644 r2670 951 951 $dumped_md5 = md5_file($file_path); 952 952 if ($dumped_md5 != $params['file_sum']) { 953 return new PwgError(500, 'file transfer tfailed');953 return new PwgError(500, 'file transfer failed'); 954 954 } 955 955 … … 981 981 $dumped_md5 = md5_file($thumbnail_path); 982 982 if ($dumped_md5 != $params['thumbnail_sum']) { 983 return new PwgError(500, 'thumbnail transfert failed'); 984 } 985 986 // fwrite($fh_log, 'output: '.md5_file($file_path)."\n"); 987 // fwrite($fh_log, 'output: '.md5_file($thumbnail_path)."\n"); 983 return new PwgError(500, 'thumbnail transfer failed'); 984 } 985 986 // high resolution 987 if (isset($params['high_content'])) 988 { 989 // high resolution directory is a subdirectory of the photo file, hard 990 // coded "pwg_high" 991 $high_dir = $upload_dir.'/pwg_high'; 992 if (!is_dir($high_dir)) { 993 umask(0000); 994 mkdir($high_dir, 0777); 995 } 996 997 // high resolution path, same name as web size file 998 $high_path = sprintf( 999 '%s/%s.%s', 1000 $high_dir, 1001 $filename_wo_ext, 1002 'jpg' 1003 ); 1004 1005 // dump the high resolution file 1006 $fh_high = fopen($high_path, 'w'); 1007 fwrite($fh_high, base64_decode($params['high_content'])); 1008 fclose($fh_high); 1009 chmod($high_path, 0644); 1010 1011 // check dumped thumbnail md5 1012 $dumped_md5 = md5_file($high_path); 1013 if ($dumped_md5 != $params['high_sum']) { 1014 return new PwgError(500, 'high resolution transfer failed'); 1015 } 1016 1017 $high_filesize = floor(filesize($high_path)/1024); 1018 } 988 1019 989 1020 list($width, $height) = getimagesize($file_path); … … 1016 1047 $insert[$key] = $params[$key]; 1017 1048 } 1049 } 1050 1051 if (isset($params['high_content'])) 1052 { 1053 $insert['has_high'] = 'true'; 1054 $insert['high_filesize'] = $high_filesize; 1018 1055 } 1019 1056 -
trunk/tools/piwigo_remote.pl
r2634 r2670 7 7 use LWP::UserAgent; 8 8 use Getopt::Long; 9 use Encode qw/is_utf8 decode/; 9 10 10 11 my %opt = (); 11 12 GetOptions( 12 13 \%opt, 13 qw/action=s file=s thumbnail=s categories=s define=s%/14 qw/action=s file=s thumbnail=s high=s categories=s define=s%/ 14 15 ); 15 16 … … 62 63 categories => $opt{categories}, 63 64 }; 65 66 if (defined $opt{high}) { 67 $form->{high_content} = encode_base64(read_file($opt{high})); 68 $form->{high_sum} = file_md5_hex($opt{high}); 69 } 64 70 65 71 foreach my $key (keys %{ $opt{define} }) { -
trunk/ws.php
r2634 r2670 181 181 'thumbnail_content' => array(), 182 182 'thumbnail_sum' => array(), 183 'high_content' => array('default' => null), 184 'high_sum' => array('default' => null), 183 185 'name' => array('default' => null), 184 186 'author' => array('default' => null),
Note: See TracChangeset
for help on using the changeset viewer.