Changeset 4724


Ignore:
Timestamp:
2003-06-18T15:11:28+12:00 (21 years ago)
Author:
davidb
Message:

ImagePlug now stores metadata for srcicon, thumbicon and screenicon
to make it pleasanter to write format statements that display
images.

File:
1 edited

Legend:

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

    r3540 r4724  
    3333
    3434
     35
    3536my $arguments = [ { 'name' => "process_exp",
    3637            'desc' => "A perl regular expression to match against filenames. Matching filenames will be processed by this plugin. Each plugin has its own default process_exp. e.g HTMLPlug defaults to '(?i)\.html?\$' i.e. all documents ending in .htm or .html (case-insensitive).",
     
    100101}
    101102
    102 
    103103sub new {
    104104    my ($class) = @_;
     
    109109    my $option_list = $self->{'option_list'};
    110110    push( @{$option_list}, $options );
    111    
     111
    112112    if (!parsargv::parse(\@_,
    113113             q^noscaleup^, \$self->{'noscaleup'},
     
    130130}
    131131
    132 
    133132sub get_default_process_exp {
    134133    my $self = shift (@_);
     
    167166    }
    168167
     168
    169169    # Convert the image to a new type (if required).
    170170    my $converttotype = $self->{'converttotype'};
     
    182182    my $result = '';
    183183    $result = `$command`;
    184     print $outhandle "$result\n" if ($verbosity > 3);
     184    print $outhandle "RESULT = $result\n" if ($verbosity > 2);
    185185
    186186    $type = $converttotype;
    187187    }
    188188   
     189
    189190    # Add the image metadata
    190191    my $url = $file;
     
    205206    $doc_obj->add_metadata ($section, "ImageSize",   $image_size);
    206207
     208   
     209    $doc_obj->add_metadata ($section, "srclink",
     210                "<a href=_httpcollection_/index/assoc/[assocfilepath]/[Image]>");
     211    $doc_obj->add_metadata ($section, "/srclink", "</a>");
     212
     213    $doc_obj->add_metadata ($section, "srcicon", "<img src=_httpcollection_/index/assoc/[assocfilepath]/[Image] width=100>");
     214
     215   
    207216    # Add the image as an associated file
    208217    $doc_obj->associate_file($filename,$file,"image/$type",$section);
     218
    209219
    210220    # Make the thumbnail image
    211221    my $thumbnailsize = $self->{'thumbnailsize'} || 100;
    212222    my $thumbnailtype = $self->{'thumbnailtype'} || 'gif';
     223   
    213224    my $thumbnailfile = &util::get_tmp_filename() . ".$thumbnailtype";
    214225    $self->{'tmp_filename2'} = $thumbnailfile;
     
    217228    my $command = "convert -interlace plane -verbose -geometry $thumbnailsize"
    218229    . "x$thumbnailsize \"$filename\" \"$thumbnailfile\"";
    219     print $outhandle "$command\n" if ($verbosity > 2);
     230    print $outhandle "THUMBNAIL: $command\n" if ($verbosity > 2);
    220231    my $result = '';
    221232    $result = `$command 2>&1` ;
    222     print $outhandle "$result\n" if ($verbosity > 3);
     233    print $outhandle "THUMB RESULT: $result\n" if ($verbosity > 2);
    223234
    224235    # Add the thumbnail as an associated file ...
     
    228239    $doc_obj->add_metadata ($section, "ThumbType", $thumbnailtype);
    229240    $doc_obj->add_metadata ($section, "Thumb", "thumbnail.$thumbnailtype");
     241
     242    $doc_obj->add_metadata ($section, "thumbicon", "<img src=_httpcollection_/index/assoc/[assocfilepath]/[Thumb] width=[ThumbWidth] height=[ThumbHeight>");
    230243    }
    231244
     
    267280        $doc_obj->add_metadata ($section, "ScreenType", $screenviewtype);
    268281        $doc_obj->add_metadata ($section, "Screen", "screenview.$screenviewtype");
     282
     283        $doc_obj->add_metadata ($section, "screenicon", "<img src=_httpcollection_/index/assoc/[assocfilepath]/[Screen] width=[ScreenWidth] height=[ScreenHeight>");
    269284    } else {
    270285        print $outhandle "ImagePlug: couldn't find \"$screenviewfilename\"\n";
     
    273288
    274289    return $type;
    275 }
     290
     291
     292}
     293
    276294
    277295
     
    412430
    4134311;
     432
     433
     434
     435
     436
     437
     438
     439
     440
     441
     442
Note: See TracChangeset for help on using the changeset viewer.