Changeset 3162 for extras/pLoader/trunk/src/Uploader
- Timestamp:
- Feb 22, 2009, 10:59:50 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extras/pLoader/trunk/src/Uploader/PWG/WebServices.pm
r3158 r3162 187 187 ); 188 188 189 190 189 my $form = { 191 method => 'pwg.images.add', 192 original_sum => $original_sum, 193 file_sum => $file_sum, 194 file_content => $file_content, 195 thumbnail_sum => $thumbnail_sum, 196 thumbnail_content => $thumbnail_content, 197 categories => $self->categories, 198 name => $self->site_image_name, 199 rank => $self->rank, 200 author => $self->site_author, 201 comment => $self->site_comment, 202 date_creation => $self->site_img_date_creation, 203 204 }; 205 206 if($self->upload_high){ 207 $form->{high_content} = encode_base64( 208 read_file( 209 $self->site_high_file, 210 binmode => ':raw', 211 ) 212 ); 213 214 $form->{high_sum} = $original_sum; 215 } 216 190 method => 'pwg.images.exist', 191 md5sum_list => $original_sum, 192 }; 217 193 218 194 my $result = $self->uagent->post( … … 221 197 ); 222 198 223 199 #print Dumper $result; 200 my $hresult = {}; 201 eval { 202 $hresult = from_json( 203 $result->{_content} 204 ); 205 }; 206 #print Dumper $hresult; 207 my $image_id = $hresult->{result}{$original_sum}; 208 if(!defined($image_id)){ 209 $form = { 210 method => 'pwg.images.add', 211 original_sum => $original_sum, 212 file_sum => $file_sum, 213 file_content => $file_content, 214 thumbnail_sum => $thumbnail_sum, 215 thumbnail_content => $thumbnail_content, 216 categories => $self->categories, 217 name => $self->site_image_name, 218 rank => $self->rank, 219 author => $self->site_author, 220 comment => $self->site_comment, 221 date_creation => $self->site_img_date_creation, 222 223 }; 224 225 if($self->upload_high){ 226 $form->{high_content} = encode_base64( 227 read_file( 228 $self->site_high_file, 229 binmode => ':raw', 230 ) 231 ); 232 233 $form->{high_sum} = $original_sum; 234 } 235 } 236 else { 237 $form = { 238 method => 'pwg.images.setInfo', 239 image_id => $image_id, 240 categories => $self->categories, 241 name => $self->site_image_name, 242 rank => $self->rank, 243 author => $self->site_author, 244 comment => $self->site_comment, 245 date_creation => $self->site_img_date_creation, 246 }; 247 } 248 249 $result = $self->uagent->post( 250 $self->urlbase.'/ws.php?format=json', 251 $form 252 ); 224 253 225 254 return ( $result->is_success, $result->status_line );
Note: See TracChangeset
for help on using the changeset viewer.