Ignore:
Timestamp:
2018-05-21T12:10:36+12:00 (6 years ago)
Author:
kjdon
Message:

change the return values of convert to match tmp_area_convert_file in AutoLoadConverters - the first return value is now a 1/0 indicating whether the conversion succeeded or not.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/ImageConverter.pm

    r32183 r32184  
    263263    if ($converttotype ne "" && $filename_full_path !~ m/$converttotype$/) {
    264264#   #    $doc_obj->add_utf8_metadata($section, "Image", $utf8_filename_meta);
    265     my ($result, $converted_filename_full_path)
     265    my ($result, $result_str, $converted_filename_full_path)
    266266        = $self->convert($filename_full_path, $converttotype, "", "CONVERTTYPE");
    267267
     268    if (!defined $result || $result == 0) {
     269        # conversion error
     270        print $outhandle "ImageConverter:convert error\n";
     271        print $outhandle "$@\n";
     272        if (defined $result_str) {
     273        print $outhandle "$result_str\n";
     274        }
     275        return 0;
     276    }
     277       
    268278    $type = $converttotype;
    269279    $filename_full_path = $converted_filename_full_path;
     
    383393
    384394    # Generate the thumbnail with convert
    385     my ($result,$thumbnailfile)
     395    my ($result, $result_str,$thumbnailfile)
    386396    = $self->convert($original_file, $thumbnailtype, "-geometry $thumbnailsize" . "x$thumbnailsize", "THUMB");
    387397   
     
    429439   
    430440    # make the screenview image
    431     my ($result,$screenviewfilename)
     441    my ($result,$result_str, $screenviewfilename)
    432442    = $self->convert($original_file, $screenviewtype, $scale_option, "SCREEN");   
    433443   
     
    507517    = $self->autorun_general_cmd($convert_command,$source_file_path,$target_file_path,$print_info);
    508518
    509     return ($result,$target_file_path);
     519    if ($had_error) {
     520    return (0, $result, $target_file_path);
     521    }
     522   
     523    return (1, $result,$target_file_path);
    510524}
    511525
Note: See TracChangeset for help on using the changeset viewer.