Changeset 31926
- Timestamp:
- 2017-09-01T12:27:21+12:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/plugins/ImageConverter.pm
r31492 r31926 96 96 'range' => "1,", 97 97 'reqd' => "no" }, 98 98 { 'name' => "store_original_image", 99 'desc' => "{ImageConverter.store_original_image}", 100 'type' => "flag", 101 'reqd' => "no"}, 99 102 { 'name' => "apply_aspectpad", 100 103 'desc' => "{ImageConverter.apply_aspectpad}", … … 212 215 # The following is potentially very muddled thinking (but currently seems to work) 213 216 # generate_images currently called from ImagePlugin and PagedImagePlugin 214 my $filename_no_path = $filename_encoded_no_path; 215 217 my $filename_no_path = $filename_encoded_no_path; 218 my $original_filename_full_path = $filename_full_path; 219 my $original_filename_no_path = $filename_no_path; 220 my $original_file_was_converted = 0; 221 216 222 # check image magick status 217 223 return 0 if $self->{'image_conversion_available'} == 0; … … 258 264 if ($converttotype ne "" && $filename_full_path !~ m/$converttotype$/) { 259 265 # # $doc_obj->add_utf8_metadata($section, "Image", $utf8_filename_meta); 260 261 266 my ($result, $converted_filename_full_path) 262 267 = $self->convert($filename_full_path, $converttotype, "", "CONVERTTYPE"); … … 269 274 $self->{'orig_file'} = $converted_filename_full_path; 270 275 } 276 $original_file_was_converted = 1; 271 277 } 272 278 … … 292 298 $self->{'orig_file'} = $aspectpad_filename_full_path; 293 299 } 294 } 295 296 297 300 $original_file_was_converted = 1; 301 302 } 303 298 304 # add Image metadata 299 305 $doc_obj->add_utf8_metadata($section, "Image", $url_to_filename_no_path); # url to generated image … … 345 351 $doc_obj->associate_file($filename_full_path, $filename_no_path, "image/$type", $section); 346 352 353 if ($self->{'store_original_image'} && $original_file_was_converted) { 354 # hack to guess the filetype 355 my ($orig_type) = ($original_filename_full_path =~ m/\.(.*?)$/); 356 # add the original image as an associated file 357 $doc_obj->associate_file($original_filename_full_path, $original_filename_no_path, "image/$orig_type", $section); 358 } 347 359 if ($self->{'create_thumbnail'} eq "true") { 348 360 $self->create_thumbnail($filename_full_path, $filehead, $doc_obj, $section, $assocfilemeta, $url_to_filehead);
Note:
See TracChangeset
for help on using the changeset viewer.