Changeset 3307


Ignore:
Timestamp:
2002-08-01T03:05:38+12:00 (22 years ago)
Author:
davidb
Message:

Some minor modifications to Image Plugin: filenames can now
include spaces, the images generated are interlaced (perhaps this
would be better controlled through an option) and the number of
file processes correctly stored through $self->{'num_processed'}

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/plugins/ImagePlug.pm

    r3137 r3307  
    109109    return 0 if ($file eq "" || $filename eq "");
    110110
    111     if ($filename =~ m/ /) {
    112     print $outhandle "ImagePlug: \"$filename\" contains a space. choking.\n";
    113     return undef;
    114     }
     111#    Code now extended to quote filenames in 'convert' commnads
     112#    Allows spaces in filenames, but note needs spaces to be escaped in URL as well
     113#    if ($filename =~ m/ /) {
     114#   print $outhandle "ImagePlug: \"$filename\" contains a space. choking.\n";
     115#   return undef;
     116#    }
    115117
    116118    my $minimumsize = $self->{'minimumsize'};
     
    131133    $self->{'tmp_filename'} = $filename;
    132134
    133     my $command = "convert -verbose $originalfilename $filename";
     135    my $command = "convert -interlace plane -verbose \"$originalfilename\" \"$filename\"";
    134136    print $outhandle "$command\n" if ($verbosity > 2);
    135137    my $result = '';
     
    141143   
    142144    # Add the image metadata
    143     $doc_obj->add_metadata ($section, "Image", "$file");
     145    my $url = $file;
     146    $url =~ s/ /%20/g;
     147
     148    $doc_obj->add_metadata ($section, "Image", $url);
    144149    my ($image_type, $image_width, $image_height, $image_size)
    145150    = &identify($filename, $outhandle, $verbosity);
     
    160165
    161166    # Generate the thumbnail with convert
    162     my $command = "convert -verbose -geometry $thumbnailsize"
    163     . "x$thumbnailsize $filename $thumbnailfile";
     167    my $command = "convert -interlace plane -verbose -geometry $thumbnailsize"
     168    . "x$thumbnailsize \"$filename\" \"$thumbnailfile\"";
    164169    print $outhandle "$command\n" if ($verbosity > 2);
    165170    my $result = '';
     
    193198
    194199    # make the screenview image
    195     my $command = "convert -verbose -geometry $screenviewsize"
    196         . "x$screenviewsize $filename $screenviewfilename";
     200    my $command = "convert -interlace plane -verbose -geometry $screenviewsize"
     201        . "x$screenviewsize \"$filename\" \"$screenviewfilename\"";
    197202    print $outhandle "$command\n" if ($verbosity > 2);
    198203    my $result = "";
     
    342347    }
    343348
     349    $self->{'num_processed'}++;
     350
    344351    return 1;
    345352}
Note: See TracChangeset for help on using the changeset viewer.