Changeset 14960
- Timestamp:
- 2008-02-12T15:16:08+13:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/plugins/ImagePlug.pm
r14954 r14960 49 49 'type' => "flag", 50 50 'reqd' => "no" }, 51 { 'name' => "nothumbnail", 52 'desc' => "{ImagePlug.generatethumbnail}", 53 'type' => "flag", 54 'reqd' => "no" }, 51 55 { 'name' => "thumbnailsize", 52 56 'desc' => "{ImagePlug.thumbnailsize}", … … 59 63 'type' => "string", 60 64 'deft' => "gif", 65 'reqd' => "no" }, 66 { 'name' => "noscreenview", 67 'desc' => "{ImagePlug.generatescreenview}", 68 'type' => "flag", 61 69 'reqd' => "no" }, 62 70 { 'name' => "screenviewsize", … … 185 193 # Also want to set filename as 'Source' metadata to be 186 194 # consistent with other plugins 187 $doc_obj->add_metadata ($section, "Source", $ url);195 $doc_obj->add_metadata ($section, "Source", $self->filename_to_metadata($url)); 188 196 189 197 my ($image_type, $image_width, $image_height, $image_size) … … 214 222 215 223 216 # Make the thumbnail image 217 my $thumbnailsize = $self->{'thumbnailsize'} || 100; 218 my $thumbnailtype = $self->{'thumbnailtype'} || 'gif'; 224 if (!$self->{'nothumbnail'}) { 225 226 # Make the thumbnail image 227 my $thumbnailsize = $self->{'thumbnailsize'} || 100; 228 my $thumbnailtype = $self->{'thumbnailtype'} || 'gif'; 229 230 # Generate the thumbnail with convert 231 my $result = $self->convert($filename, $thumbnailtype, "-geometry $thumbnailsize" . "x$thumbnailsize", "THUMB"); 232 my ($thumbnailfile) = ($result =~ /=>(.*\.$thumbnailtype)/); 219 233 220 # Generate the thumbnail with convert 221 my $result = $self->convert($filename, $thumbnailtype, "-geometry $thumbnailsize" . "x$thumbnailsize", "THUMB"); 222 my ($thumbnailfile) = ($result =~ /=>(.*\.$thumbnailtype)/); 223 224 # Add the thumbnail as an associated file ... 225 if (-e "$thumbnailfile") { 226 $doc_obj->associate_file("$thumbnailfile", "thumbnail.$thumbnailtype", 227 "image/$thumbnailtype",$section); 228 $doc_obj->add_metadata ($section, "ThumbType", $thumbnailtype); 229 $doc_obj->add_metadata ($section, "Thumb", "thumbnail.$thumbnailtype"); 230 231 $doc_obj->add_metadata ($section, "thumbicon", "<img src=\"_httpprefix_/collect/[collection]/index/assoc/[assocfilepath]/[Thumb]\" width=[ThumbWidth] height=[ThumbHeight]>"); 232 } 233 234 # Extract Thumnail metadata from convert output 235 if ($result =~ m/[0-9]+x[0-9]+=>([0-9]+)x([0-9]+)/) { 236 $doc_obj->add_metadata ($section, "ThumbWidth", $1); 237 $doc_obj->add_metadata ($section, "ThumbHeight", $2); 238 } 234 # Add the thumbnail as an associated file ... 235 if (-e "$thumbnailfile") { 236 $doc_obj->associate_file("$thumbnailfile", "thumbnail.$thumbnailtype", 237 "image/$thumbnailtype",$section); 238 $doc_obj->add_metadata ($section, "ThumbType", $thumbnailtype); 239 $doc_obj->add_metadata ($section, "Thumb", "thumbnail.$thumbnailtype"); 240 241 $doc_obj->add_metadata ($section, "thumbicon", "<img src=\"_httpprefix_/collect/[collection]/index/assoc/[assocfilepath]/[Thumb]\" width=[ThumbWidth] height=[ThumbHeight]>"); 242 } 243 244 # Extract Thumnail metadata from convert output 245 if ($result =~ m/[0-9]+x[0-9]+=>([0-9]+)x([0-9]+)/) { 246 $doc_obj->add_metadata ($section, "ThumbWidth", $1); 247 $doc_obj->add_metadata ($section, "ThumbHeight", $2); 248 } 249 250 } 251 239 252 240 253 # Make a screen-sized version of the picture if requested 241 if ( $self->{'screenviewsize'}) {254 if (!$self->{'noscreenview'}) { 242 255 243 256 # To do: if the actual image smaller than the screenview size,
Note:
See TracChangeset
for help on using the changeset viewer.