Changeset 16771 for gsdl/trunk/perllib/plugins/ImageConverter.pm
- Timestamp:
- 2008-08-13T20:35:13+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/plugins/ImageConverter.pm
r16521 r16771 181 181 } 182 182 183 # Images that will get generated may contain percent signs in their src filenames 184 # Encode those percent signs themselves so that urls to the imgs refer to them correctly 185 my $url_to_filehead = $filehead; 186 $url_to_filehead =~ s/%/%25/g; 187 my $url_to_filename_no_path = $filename_no_path; 188 $url_to_filename_no_path =~ s/%/%25/g; 189 183 190 # Convert the image to a new type (if required). 184 191 my $converttotype = $self->{'converttotype'}; … … 186 193 187 194 if ($converttotype ne "" && $filename_full_path !~ m/$converttotype$/) { 188 195 # $doc_obj->add_utf8_metadata($section, "Image", $utf8_filename_meta); 196 189 197 my $result = $self->convert($filename_full_path, $converttotype, "", ""); 190 198 ($filename_full_path) = ($result =~ /=>(.*\.$converttotype)/); … … 192 200 $type = $converttotype; 193 201 $filename_no_path = "$filehead.$type"; 202 $url_to_filename_no_path = "$url_to_filehead.$type"; 194 203 } 195 204 196 205 # add Image metadata 197 $doc_obj->add_utf8_metadata($section, "Image", $ filename_no_path);206 $doc_obj->add_utf8_metadata($section, "Image", $url_to_filename_no_path); # url to generated image 198 207 199 208 # here we overwrite the original with the potentially converted one 200 $doc_obj->set_utf8_metadata_element($section, "Source", $filename_no_path); 209 $doc_obj->set_utf8_metadata_element($section, "Source", $filename_no_path); # name of generated image 201 210 202 211 # use identify to get info about the (possibly converted) image … … 225 234 226 235 if ($self->{'create_thumbnail'} eq "true") { 227 $self->create_thumbnail($filename_full_path, $filehead, $doc_obj, $section, $assocfilemeta );236 $self->create_thumbnail($filename_full_path, $filehead, $doc_obj, $section, $assocfilemeta, $url_to_filehead); 228 237 } 229 238 if ($self->{'create_screenview'} eq "true") { 230 $self->create_screenview($filename_full_path, $filehead, $doc_obj, $section, $assocfilemeta );239 $self->create_screenview($filename_full_path, $filehead, $doc_obj, $section, $assocfilemeta, $url_to_filehead); 231 240 } 232 241 } … … 234 243 sub create_thumbnail { 235 244 my $self = shift(@_); 236 my ($original_file, $filehead, $doc_obj, $section, $assocfilemeta) = @_; 245 my ($original_file, $filehead, $doc_obj, $section, $assocfilemeta, $url_to_filehead) = @_; 246 $url_to_filehead = $filehead unless defined $url_to_filehead; 237 247 238 248 my $thumbnailsize = $self->{'thumbnailsize'}; … … 246 256 if (-e "$thumbnailfile") { 247 257 $doc_obj->associate_file("$thumbnailfile", $filehead."_thumb.$thumbnailtype", 248 "image/$thumbnailtype",$section); 258 "image/$thumbnailtype",$section); # name of generated image 249 259 $doc_obj->add_metadata ($section, "ThumbType", $thumbnailtype); 250 $doc_obj->add_utf8_metadata ($section, "Thumb", $ filehead."_thumb.$thumbnailtype");260 $doc_obj->add_utf8_metadata ($section, "Thumb", $url_to_filehead."_thumb.$thumbnailtype"); # url to generated image 251 261 252 262 $doc_obj->add_metadata ($section, "thumbicon", "<img src=\"_httpprefix_/collect/[collection]/index/assoc/$assocfilemeta/[Thumb]\" width=[ThumbWidth] height=[ThumbHeight]>"); … … 268 278 269 279 my $self = shift(@_); 270 my ($original_file, $filehead, $doc_obj, $section, $assocfilemeta) = @_; 280 my ($original_file, $filehead, $doc_obj, $section, $assocfilemeta, $url_to_filehead) = @_; 281 $url_to_filehead = $filehead unless defined $url_to_filehead; 271 282 272 283 # To do: if the actual image smaller than the screenview size, … … 283 294 #add the screenview as an associated file ... 284 295 if (-e "$screenviewfilename") { 285 $doc_obj->associate_file("$screenviewfilename", $filehead."_screen.$screenviewtype", "image/$screenviewtype",$section); 296 $doc_obj->associate_file("$screenviewfilename", $filehead."_screen.$screenviewtype", "image/$screenviewtype",$section); # name of generated image 286 297 $doc_obj->add_metadata ($section, "ScreenType", $screenviewtype); 287 $doc_obj->add_utf8_metadata ($section, "Screen", $ filehead."_screen.$screenviewtype");298 $doc_obj->add_utf8_metadata ($section, "Screen", $url_to_filehead."_screen.$screenviewtype"); # url to generated image 288 299 289 300 $doc_obj->add_metadata ($section, "screenicon", "<img src=\"_httpprefix_/collect/[collection]/index/assoc/$assocfilemeta/[Screen]\" width=[ScreenWidth] height=[ScreenHeight]>");
Note:
See TracChangeset
for help on using the changeset viewer.