Changeset 2816 for trunk/gsdl


Ignore:
Timestamp:
2001-11-05T16:29:23+13:00 (22 years ago)
Author:
sjboddie
Message:

Added cover_image option to BasPlug for associating a jpeg image as a
cover image (like the old HBPlug used to do).

Location:
trunk/gsdl/perllib/plugins
Files:
2 edited

Legend:

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

    r2811 r2816  
    119119    print STDERR "                     14th century)\n";
    120120    print STDERR "   -no_bibliography  Do not try and block bibliographic dates when extracting\n";
    121     print STDERR "                     historical dates.\n\n";
     121    print STDERR "                     historical dates.\n";
     122    print STDERR "   -cover_image      Will look for a prefix.jpg file (where prefix is the same\n";
     123    print STDERR "                     prefix as the file being processed) and associate it as a\n";
     124    print STDERR "                     cover image\n\n";
    122125}
    123126
     
    165168             q^no_bibliography^, \$self->{'no_biblio'},
    166169             qq^maximum_century/-?\\d{1,2}( ?B\\.C\\.E\\.)?/-1^, \$self->{'max_century'},
     170             q^cover_image^, \$self->{'cover_image'},
    167171             "allow_extra_options")) {
    168172   
     
    284288    my ($filemeta) = $file =~ /([^\\\/]+)$/;
    285289    $doc_obj->add_utf8_metadata($doc_obj->get_top_section(), "Source", &ghtml::dmsafe($filemeta));
     290    if ($self->{'cover_image'}) {
     291    $self->associate_cover_image($doc_obj, $filename);
     292    }
    286293   
    287294    # read in file ($text will be in utf8)
     
    707714}
    708715
     716sub associate_cover_image {
     717    my $self = shift(@_);
     718    my ($doc_obj, $filename) = @_;
     719
     720    $filename =~ s/\.[^\\\/\.]+$/\.jpg/;
     721    if (-e $filename) {
     722    $doc_obj->associate_file($filename, "cover.jpg", "image/jpeg");
     723    }
     724}
     725
    7097261;
  • trunk/gsdl/perllib/plugins/ConvertToPlug.pm

    r2811 r2816  
    272272    my ($filemeta) = $file =~ /([^\\\/]+)$/;
    273273    $doc_obj->add_utf8_metadata($doc_obj->get_top_section(), "Source", &ghtml::dmsafe($filemeta));
     274    if ($self->{'cover_image'}) {
     275    $self->associate_cover_image($doc_obj, $filename);
     276    }
    274277
    275278    # include any metadata passed in from previous plugins
Note: See TracChangeset for help on using the changeset viewer.