source: trunk/gsdl/perllib/plugins/W3ImgPlug.pm@ 7830

Last change on this file since 7830 was 7362, checked in by kjdon, 20 years ago

plugin read functions now return 'undef' - didn't recognise, '-1' - recognised but had an error during processing, '0' - blocked or didn't process but don't pass it on to other plugins, or 'num_docs' processed. this emables a bit better error reporting about what has happened to each file

  • Property svn:keywords set to Author Date Id Revision
File size: 37.4 KB
Line 
1###########################################################################
2#
3# W3ImgPlug.pm -- Context-based image indexing plugin for HTML documents
4#
5# A component of the Greenstone digital library software
6# from the New Zealand Digital Library Project at the
7# University of Waikato, New Zealand.
8#
9# Copyright (C) 2001 New Zealand Digital Library Project
10#
11# This program is free software; you can redistribute it and/or modify
12# it under the terms of the GNU General Public License as published by
13# the Free Software Foundation; either version 2 of the License, or
14# (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with this program; if not, write to the Free Software
23# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24#
25###########################################################################
26
27# DESCRIPTION:
28#
29# Extracts images and associated text and metadata from
30# web pages as individual documents for indexing. Thumbnails
31# are created from each image for browsing purposes.
32#
33# Options are available for configuring the aggressiveness of the
34# associated text extraction mechanisms. A higher level of
35# aggressiveness will extract more text and consequently
36# may mean lower accuracy (precision); however, it may also
37# retrieve more of the relevant images from the collection (recall).
38# Lower levels of aggressiveness maybe result in slightly faster
39# collection builds at the import stage.
40#
41# W3ImgPlug is a subclass of HTMLPlug (i.e. it will index pages also
42# if required). It can be used in place of HTMLPlug to index both
43# pages and their images.
44#
45# REQUIREMENTS:
46#
47# The ImageMagick image manipulation is used to create
48# thumbnails and extract some image metadata. (Available
49# from http://www.imagemagick.org/)
50#
51# Unix:
52# Many Linux distributions contain ImageMagick.
53#
54# Windows:
55# ImageMagick can be downloaded from the website above.
56# Make sure the system path includes the ImageMagick binaries
57# before using W3ImgPlug.
58#
59# NOTE: NT/2000/XP contain a filesystem utility 'convert.exe'
60# with the same name as the image conversion utility. The
61# ImageMagick FAQ recommends renaming the filesystem
62# utility (e.g. to 'fsconvert.exe') to avoid this clash.
63#
64# USAGE:
65#
66# An image document consists of metadata elements:
67#
68# OriginalFilename, FilePath, Filename, FileExt, FileSize,
69# Width, Height, URL, PageURL, ThumbURL, CacheURL, CachePageURL
70# ImageText, PageTitle
71#
72# Most of these are only useful in format strings (e.g. ThumbURL,
73# Filename, URL, PageURL, CachePageURL).
74#
75# ImageText, as the name suggests contains the indexable text.
76# (unless using the -document_text plugin option)
77#
78# Since image documents are made up of metadata elements
79# alone, format strings are needed to display them properly.
80# NOTE: The receptionist will only display results (e.g. thumbnails)
81# in 4 columns if the format string begins with "<td><table>".
82#
83# The example below takes the user to the image within the
84# source HTML document rather than using a format string
85# on DocumentText to display the image document itself.
86#
87# Example collect.cfg:
88#
89# ...
90#
91# indexes document:ImageText document:text
92# defaultindex document:ImageText
93#
94# collectionmeta .document:ImageText "images"
95# collectionmeta .document:text "documents"
96#
97# ...
98#
99# plugin W3ImgPlug -index_pages -aggressiveness 6
100#
101# ...
102#
103# format SearchVList '<td>{If}{[Title],[link][icon]&nbsp;[Title][[/link],
104# <table><tr><td align="center"><a href="[CachePageURL]">
105# <img src="[ThumbURL]"></a></td></tr><tr><td align="center">
106# <a href="[CachePageURL]"><font size="-1">[OriginalFilename]</font></a>
107# <br>[Width]x[Height]</td></tr></table>}</td>'
108#
109# ...
110#
111
112package W3ImgPlug;
113
114use HTMLPlug;
115use ghtml;
116use unicode;
117use util;
118use parsargv;
119use strict 'subs';
120
121sub BEGIN {
122 @ISA = qw( HTMLPlug );
123}
124
125my $aggressiveness_list =
126 [ { 'name' => "1",
127 'desc' => "{W3ImgPlug.aggressiveness.1}" },
128 { 'name' => "2",
129 'desc' => "{W3ImgPlug.aggressiveness.2}" },
130 { 'name' => "3",
131 'desc' => "{W3ImgPlug.aggressiveness.3}" },
132 { 'name' => "4",
133 'desc' => "{W3ImgPlug.aggressiveness.4}" },
134 { 'name' => "5",
135 'desc' => "{W3ImgPlug.aggressiveness.5}" },
136 { 'name' => "6",
137 'desc' => "{W3ImgPlug.aggressiveness.6}" },
138 { 'name' => "7",
139 'desc' => "{W3ImgPlug.aggressiveness.7}" },
140 { 'name' => "8",
141 'desc' => "{W3ImgPlug.aggressiveness.8}" },
142 { 'name' => "9",
143 'desc' => "{W3ImgPlug.aggressiveness.9}" } ];
144
145my $arguments =
146 [ { 'name' => "aggressiveness",
147 'desc' => "{W3ImgPlug.aggressiveness}",
148 'type' => "int",
149 'list' => $aggressiveness_list,
150 'deft' => "3",
151 'reqd' => "no" },
152 { 'name' => "index_pages",
153 'desc' => "{W3ImgPlug.index_pages}",
154 'type' => "flag",
155 'reqd' => "no" },
156 { 'name' => "no_cache_images",
157 'desc' => "{W3ImgPlug.no_cache_images}",
158 'type' => "flag",
159 'reqd' => "no" },
160 { 'name' => "min_size",
161 'desc' => "{W3ImgPlug.min_size}",
162 'type' => "int",
163 'deft' => "2000",
164 'reqd' => "no" },
165 { 'name' => "min_width",
166 'desc' => "{W3ImgPlug.min_width}",
167 'type' => "int",
168 'deft' => "50",
169 'reqd' => "no" },
170 { 'name' => "min_height",
171 'desc' => "{W3ImgPlug.min_height}",
172 'type' => "int",
173 'deft' => "50",
174 'reqd' => "no" },
175 { 'name' => "thumb_size",
176 'desc' => "{W3ImgPlug.thumb_size}",
177 'type' => "int",
178 'deft' => "100",
179 'reqd' => "no" },
180 { 'name' => "convert_params",
181 'desc' => "{W3ImgPlug.convert_params}",
182 'type' => "string",
183 'deft' => "",
184 'reqd' => "no" },
185 { 'name' => "min_near_text",
186 'desc' => "{W3ImgPlug.min_near_text}",
187 'type' => "int",
188 'deft' => "10",
189 'reqd' => "no" },
190 { 'name' => "max_near_text",
191 'desc' => "{W3ImgPlug.max_near_text}",
192 'type' => "int",
193 'deft' => "400",
194 'reqd' => "no" },
195 { 'name' => "smallpage_threshold",
196 'desc' => "{W3ImgPlug.smallpage_threshold}",
197 'type' => "int",
198 'deft' => "2048",
199 'reqd' => "no" },
200 { 'name' => "textrefs_threshold",
201 'desc' => "{W3ImgPlug.textrefs_threshold}",
202 'type' => "int",
203 'deft' => "2",
204 'reqd' => "no" },
205 { 'name' => "caption_length",
206 'desc' => "{W3ImgPlug.caption_length}",
207 'type' => "int",
208 'deft' => "80",
209 'reqd' => "no" },
210 { 'name' => "neartext_length",
211 'desc' => "{W3ImgPlug.neartext_length}",
212 'type' => "int",
213 'deft' => "300",
214 'reqd' => "no" },
215 { 'name' => "document_text",
216 'desc' => "{W3ImgPlug.document_text}",
217 'type' => "flag",
218 'reqd' => "no" } ];
219
220my $options = { 'name' => "W3ImgPlug",
221 'desc' => "{W3ImgPlug.desc}",
222 'abstract' => "no",
223 'inherits' => "yes",
224 'args' => $arguments };
225
226sub new {
227 my $class = shift (@_);
228 my $self = new HTMLPlug ($class, @_);
229 $self->{'plugin_type'} = "W3ImgPlug";
230 # 14-05-02 To allow for proper inheritance of arguments - John Thompson
231 my $option_list = $self->{'option_list'};
232 push( @{$option_list}, $options );
233
234 if (!parsargv::parse(\@_,
235 q^aggressiveness/\d/3^, \$self->{'aggressiveness'},
236 q^index_pages^, \$self->{'index_pages'},
237 q^no_cache_images^, \$self->{'no_cache_images'},
238 q^min_size/\d*/2000^, \$self->{'min_img_filesize'},
239 q^min_width/\d*/50^, \$self->{'min_img_width'},
240 q^min_height/\d*/50^, \$self->{'min_img_height'},
241 q^thumb_size/\d*/100^, \$self->{'thumbnail_size'},
242 q^convert_params/.*/ ^, \$self->{'img_convert_param'},
243 q^max_near_text/\d*/400^, \$self->{'maxtext'},
244 q^min_near_text/\d*/10^, \$self->{'mintext'},
245 q^smallpage_threshold/\d*/2048^, \$self->{'smallpage_threshold'},
246 q^textrefs_threshold/\d*/2^, \$self->{'textref_threshold'},
247 q^caption_length/\d*/80^, \$self->{'caption_len'},
248 q^neartext_length/\d*/300^, \$self->{'neartext_len'},
249 q^document_text^, \$self->{'document_text'},
250 "allow_extra_options"
251 )) {
252
253 print STDERR "\nIncorrect options passed to W3ImgPlug, check your collect.cfg configuration file\n";
254 $self->print_txt_usage(""); # Use default resource bundle
255 die "\n";
256 }
257
258 # init class variables
259 $self->{'textref'} = undef; # init by read_file fn
260 $self->{'htdoc_obj'} = undef; # init by process fn
261 $self->{'htpath'} = undef; # init by process fn
262 $self->{'hturl'} = undef; # init by process fn
263 $self->{'plaintext'} = undef; # HTML stripped version - only init if needed by raw_neartext sub
264 $self->{'smallpage'} = 0; # set by process fn
265 $self->{'images_indexed'} = undef; # num of images indexed - if 1 or 2 then we know page is small
266 $self->{'initialised'} = undef; # flag (see set_extraction_options())
267
268 return bless $self, $class;
269}
270
271# if indexing pages, let HTMLPlug do it's stuff
272# image extraction done through read()
273sub process {
274 my ($self, $textref, $pluginfo, $base_dir, $file, $metadata, $doc_obj) = @_;
275 $self->{'imglist'} = ();
276 if ( $self->{'index_pages'} ) {
277 my $ok = $self->SUPER::process($textref, $pluginfo, $base_dir, $file, $metadata, $doc_obj);
278 if ( ! $ok ) { return $ok }
279 $self->{'htdoc_obj'} = $doc_obj;
280 }
281 # else use URL for referencing
282 #if ( $file =~ /(.*)[\/\\]/ ) { $self->{'htpath'} = $1; } else { $self->{'htpath'} = $file; }
283
284 $self->{'htpath'} = $base_dir if (-d $base_dir);
285 if ( $file =~ /(.*)[\/\\]/ ) { $self->{'htpath'} .= "/$1"; }
286 $self->{'htpath'} =~ s/\\/\//g; # replace \ with /
287
288 $self->{'hturl'} = "http://$file";
289 $self->{'hturl'} =~ s/\\/\//g; # for windows
290 ($self->{'filename'}) = $file =~ /.*[\/\\](.*)/;
291 ($self->{'base_path'}) = $file =~ /(.*)[\/\\]/i;
292 if ( ( -s "$base_dir/$file") <= $self->{'smallpage_threshold'} ) {
293 $self->{'smallpage'} = 1;
294 } else { $self->{'smallpage'} = 0; }
295
296 if ( defined($self->{'initialised'}) ) { return 1; }
297 else {
298 $self->{'initialised'} = $self->set_extraction_options($base_dir =~ /^(.*?)\/import/i);
299 return $self->{'initialised'};
300 }
301}
302
303# get complex configuration options from configuration files
304# -- $GSDLCOLLECTION/etc/W3ImgPlug.cfg (tag sets for aggr 2+)
305# -- $GSDLHOME/etc/packages/phind/stopword/en/brown.sw (stopwords for aggr 5+)
306
307# If there's no W3ImgPlug.cfg file we'll use the following default values
308my $defaultcfg = '
309<delimitertagset>
310 <setname>Caption</setname>
311 <taggroup>font</taggroup>
312 <taggroup>tt</taggroup>
313 <taggroup>small</taggroup>
314 <taggroup>b</taggroup>
315 <taggroup>i</taggroup>
316 <taggroup>u</taggroup>
317 <taggroup>em</taggroup>
318 <taggroup>td</taggroup>
319 <taggroup>li</taggroup>
320 <taggroup>a</taggroup>
321 <taggroup>p</taggroup>
322 <taggroup>tr</taggroup>
323 <taggroup>center</taggroup>
324 <taggroup>div</taggroup>
325 <taggroup>caption</taggroup>
326 <taggroup>br</taggroup>
327 <taggroup>ul</taggroup>
328 <taggroup>ol</taggroup>
329 <taggroup>table</taggroup>
330 <taggroup>hr</taggroup>
331</delimitertagset>
332
333<delimitertagset>
334 <setname>Neartext</setname>
335 <taggroup>tr|hr|table|h\d|img|body</taggroup>
336 <taggroup>td|tr|hr|table|h\d|img|body</taggroup>
337 <taggroup>p|br|td|tr|hr|table|h\d|img|body</taggroup>
338 <taggroup>font|p|i|b|em|img</taggroup>
339</delimitertagset>
340';
341
342sub set_extraction_options() {
343 my ($self, $collpath) = @_;
344 my ($filepath);
345
346 print {$self->{'outhandle'}} "W3ImgPlug: Initialising\n"
347 if $self->{'verbosity'} > 1;
348 # etc/W3ImgPlug.cfg (XML)
349 # tag sets for captions and neartext
350 if ( $self->{'aggressiveness'} > 1 && $self->{'aggressiveness'} != 9 ) {
351 $self->{'delims'} = [];
352 $self->{'cdelims'} = [];
353 my ($cfg, @tagsets, $tagset, $type, @delims);
354
355 $filepath = "$collpath/etc/W3ImgPlug.cfg";
356 if ( open CFG, "<$filepath" ) {
357 while (<CFG>) { $cfg .= $_ }
358 close CFG;
359 } else {
360 $cfg = $defaultcfg;
361 }
362
363 (@tagsets) =
364 $cfg =~ /<delimitertagset>(.*?)<\/delimitertagset>/igs;
365 foreach $tagset ( @tagsets ) {
366 ($type) = $tagset =~ /<setname>(.*?)<\/setname>/i;
367 if ( lc($type) eq "caption" ) {
368 (@{$self->{'cdelims'}}) = $tagset =~ /<taggroup>(.*?)<\/taggroup>/igs;
369 }
370 elsif ( lc($type) eq "neartext" ) {
371 (@{$self->{'delims'}}) = $tagset =~ /<taggroup>(.*?)<\/taggroup>/igs;
372 }
373 }
374
375 # output a warning if there seem to be no delimiters
376 if ( scalar(@{$self->{'cdelims'}} == 0)) {
377 print {$self->{'outhandle'}} "W3ImgPlug: Warning: no caption delimiters found in $filepath\n";
378 }
379 if ( scalar(@{$self->{'delims'}} == 0)) {
380 print {$self->{'outhandle'}} "W3ImgPlug: Warning: no neartext delimiters found in $filepath\n";
381 }
382 }
383
384 # get stop words for textual reference extraction
385 # TODO: warnings scroll off. Would be best to output them again at end of import
386 if ( $self->{'aggressiveness'} >=5 && $self->{'aggressiveness'} != 9 ) {
387 $self->{'stopwords'} = ();
388 $filepath = &util::filename_cat($ENV{'GSDLHOME'}, "etc", "packages", "phind", "stopword", "en", "brown.sw");
389 if ( open STOPWORDS, "<$filepath" ) {
390 while ( <STOPWORDS> ) {
391 chomp;
392 $self->{'stopwords'}{$_} = 1;
393 }
394 close STOPWORDS;
395 } else {
396 print {$self->{'outhandle'}} "W3ImgPlug: Warning: couldn't open stopwords file at $filepath ($!)\n";
397 }
398
399 }
400
401 if ( $self->{'neartext_len'} > $self->{'maxtext'} ) {
402 $self->{'maxtext'} = $self->{'neartext_len'} * 1.33;
403 print {$self->{'outhandle'}} "W3ImgPlug: Warning: adjusted max_text to $self->{'maxtext'}\n";
404 }
405 if ( $self->{'caption_len'} > $self->{'maxtext'} ) {
406 $self->{'maxtext'} = $self->{'caption_len'} * 1.33;
407 print {$self->{'outhandle'}} "W3ImgPlug: Warning: adjusted max_text to $self->{'maxtext'}\n";
408 }
409
410 return 1;
411}
412
413# return number of files processed, undef if can't recognise, -1 if
414# cant process
415# Note that $base_dir might be "" and that $file might
416# include directories
417sub read {
418 my ($self, $pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs) = (@_);
419 my ($doc_obj, $section, $filepath, $imgtag, $pos, $context, $numdocs, $tndir, $imgs);
420 # forward normal read (runs HTMLPlug if index_pages T)
421 my $ok = $self->SUPER::read($pluginfo, $base_dir, $file, $metadata, $processor, $maxdocs);
422 if ( ! $ok ) { return $ok } # what is this returning??
423
424 my $outhandle = $self->{'outhandle'};
425 my $textref = $self->{'textref'};
426 my $htdoc_obj = $self->{'htdoc_obj'};
427 $numdocs = 0;
428 $base_dir =~ /(.*)\/.*/;
429 $tndir = "$1/archives/thumbnails"; # TODO: this path shouldn't be hardcoded?
430 &util::mk_all_dir($tndir) unless -e "$tndir";
431
432 $imgs = \%{$self->{'imglist'}};
433 my $nimgs = $self->get_img_list($textref);
434 $self->{'images_indexed'} = $nimgs;
435 if ( $nimgs > 0 ) {
436 my @fplist = (sort { $imgs->{$a}{'pos'} <=> $imgs->{$b}{'pos'} } keys %{$imgs});
437 my $i = 0;
438 foreach $filepath ( @fplist ) {
439 $pos = $imgs->{$filepath}{'pos'};
440 $context = substr ($$textref, $pos - 50, $pos + 50); # grab context (quicker)
441 ($imgtag) = ($context =~ /(<(?:img|a|body)\s[^>]*$filepath[^>]*>)/is );
442 if (! defined($imgtag)) { $imgtag = $filepath }
443 print $outhandle "W3ImgPlug: extracting $filepath\n"
444 if ( $self->{'verbosity'} > 1 );
445 $doc_obj = new doc ("", "indexed_doc");
446 $section = $doc_obj->get_top_section();
447 $prevpos = ( $i == 0 ? 0 : $imgs->{$fplist[$i - 1]}{'pos'});
448 $nextpos = ( $i >= ($nimgs -1) ? -1 : $imgs->{$fplist[$i + 1]}{'pos'} );
449
450 $self->extract_image_info($imgtag, $filepath, $textref, $doc_obj, $section, $tndir, $prevpos, $nextpos);
451 $processor->process($doc_obj);
452 $numdocs++;
453 $i++;
454 }
455 return $numdocs;
456 } else {
457 print $outhandle "W3ImgPlug: No images from $file indexed\n"
458 if ( $self->{'verbosity'} > 2 );
459 return 1;
460 }
461
462}
463
464# for every valid image tag
465# 1. extract related text and image metadata
466# 2. add this as document meta-data
467# 3. add assoc image(s) as files
468#
469sub extract_image_info {
470 my $self = shift (@_);
471 my ($tag, $id, $textref, $doc_obj, $section, $tndir, $prevpos, $nextpos) = (@_);
472 my ($filename, $orig_fp, $fn, $ext, $reltext, $relreltext, $crcid, $imgs,
473 $thumbfp, $pagetitle, $alttext, $filepath, $aggr);
474 $aggr = $self->{'aggressiveness'};
475 $imgs = \%{$self->{'imglist'}};
476 $filepath = $imgs->{$id}{'relpath'};
477 ($filename) = $filepath =~ /([^\/\\]+)$/s;
478 ($orig_fp) = "$self->{'base_path'}/$filepath";
479 $orig_fp =~ tr/+/ /;
480 $orig_fp =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; # translate %2E to space, etc
481 $orig_fp =~ s/\\/\//g;
482 $filepath = "$self->{'htpath'}/$filepath";
483 ($onlyfn) = $filename =~ /([^\\\/]*)$/;
484 ($fn, $ext) = $onlyfn =~ /(.*)\.(.*)/;
485 $fn = lc $fn; $ext = lc $ext;
486 ($reltext) = "<tr><td>GifComment</td><td>" . `identify $filepath -ping -format "%c"` . "</td></tr>\n"
487 if ($ext eq "gif");
488 $reltext .= "<tr><td>FilePath</td><td>$orig_fp</td></tr>\n";
489
490 if ($ENV{'GSDLOS'} =~ /^windows$/i) {
491 $crcid = "$fn.$ext." . $self->{'next_crcid'}++;
492 } else { ($crcid) = `cksum $filepath` =~ /^(\d+)/; }
493 $thumbfp = "$tndir/tn_$crcid.jpg";
494 `convert -flatten -filter Hanning $self->{'img_convert_param'} -geometry "$self->{'thumbnail_size'}x$self->{'thumbnail_size'}>" $filepath $thumbfp` unless -e $thumbfp;
495 if ( ! (-e $thumbfp) ) {
496 print STDERR "W3ImgPlug: 'convert' failed. Check ImageMagicK binaries are installed and working correctly\n"; return 0;
497 }
498
499 # shove in full text (tag stripped or unstripped) if settings require it
500 if ( $aggr == 10) {
501 $reltext = "<tr><td>AllPage</td><td>" . $$textref . "</td><tr>\n"; # level 10 (all text, verbatim)
502 } else {
503 $pagetitle = $self->get_meta_value("title", $textref);
504 ($alttext) = $tag =~ /\salt\s*=\s*(?:\"|\')(.+?)(?:\"|\')/is;
505 if ( defined($alttext) && length($alttext) > 1) {
506 $reltext .= "<tr><td>ALTtext</td><td>$alttext</td></tr>\n"; }
507 $reltext .= "<tr><td>SplitCapitalisation</td><td>" .
508 $self->split_filepath($orig_fp) . "</td></tr>\n";
509
510 # get caption/tag based near text (if appropriate)
511 if ( $aggr > 1 ) {
512 if ( $aggr >= 2 ) {
513 $reltext .=
514 $self->extract_caption_text($tag, $textref, $prevpos, $imgs->{$id}{'pos'}, $nextpos);
515 $relreltext = $reltext;
516 }
517 # repeat the filepath, alt-text, caption, etc
518 if ( $aggr == 8 ) {
519 $reltext .= $relreltext;
520 }
521 if ( $aggr >= 3 ) {
522 $reltext .=
523 $self->extract_near_text($tag, $textref, $prevpos, $imgs->{$id}{'pos'}, $nextpos);
524 }
525
526 # get page metadata (if appropriate)
527 if ( $aggr >= 6 || ( $aggr >= 2 &&
528 ( $self->{'images_indexed'} < 2 ||
529 ($self->{'smallpage'} == 1 && $self->{'images_indexed'} < 6 )))) {
530 $reltext .= $self->get_page_metadata($textref);
531 }
532 # textual references
533 if ( $aggr == 5 || $aggr >= 7) {
534 if ( length($relreltext) > ($self->{'caption_len'} * 2) ) {
535 $reltext .= $self->get_textrefs($relreltext, $textref, $prevpos, $imgs->{$id}{'pos'}, $nextpos); }
536 else {
537 $reltext .= $self->get_textrefs($reltext, $textref, $prevpos, $imgs->{$id}{'pos'}, $nextpos);
538 }
539 }
540 } # aggr > 1
541 } # aggr != 10
542
543 $doc_obj->set_OID($crcid);
544 $doc_obj->associate_file($thumbfp, "$fn.thumb.jpg", undef, $section);
545 $doc_obj->add_metadata($section, "OriginalFilename", $filename);
546 $doc_obj->add_metadata($section, "FilePath", $orig_fp);
547 $doc_obj->add_metadata($section, "Filename", $fn);
548 $doc_obj->add_metadata($section, "FileExt", $ext);
549 $doc_obj->add_metadata($section, "FileSize", $imgs->{$id}{'filesize'});
550 $doc_obj->add_metadata($section, "Width", $imgs->{$id}{'width'});
551 $doc_obj->add_metadata($section, "Height", $imgs->{$id}{'height'});
552 $doc_obj->add_metadata($section, "URL", "http://$orig_fp");
553 $doc_obj->add_metadata($section, "PageURL", $self->{'hturl'});
554 $doc_obj->add_metadata($section, "PageTitle", $pagetitle);
555 $doc_obj->add_metadata($section, "ThumbURL",
556 "_httpcollection_/index/assoc/[archivedir]/$fn.thumb.jpg");
557
558 if ( $self->{'document_text'} ) {
559 $doc_obj->add_utf8_text($section, "<table border=1>\n$reltext</table>");
560 } else {
561 $doc_obj->add_metadata($section, "ImageText", "<table border=1>\n$reltext</table>\n");
562 }
563
564 if ( $self->{'index_pages'} ) {
565 my ($cache_url) = "_httpdoc_&d=" . $self->{'htdoc_obj'}->get_OID();
566 if ( $imgs->{$id}{'anchored'} ) {
567 my $a_name = $id;
568 $a_name =~ s/[\/\\\:\&]/_/g;
569 $cache_url .= "#gsdl_$a_name" ;
570 }
571 $doc_obj->add_utf8_metadata($section, "CachePageURL", $cache_url);
572 }
573 if ( ! $self->{'no_cache_images'} ) {
574 $onlyfn = lc $onlyfn;
575 $doc_obj->associate_file($filepath, $onlyfn, undef, $section);
576 $doc_obj->add_utf8_metadata($section, "CacheURL",
577 "_httpcollection_/index/assoc/[archivedir]/$onlyfn");
578 }
579 return 1;
580}
581
582sub get_page_metadata {
583 my ($self, $textref) = (@_);
584 my (@rval);
585 $rval[0] = $self->get_meta_value("title", $textref);
586 $rval[1] = $self->get_meta_value("keywords", $textref);
587 $rval[2] = $self->get_meta_value("description", $textref);
588 $rval[3] = $self->{'filename'};
589
590 return wantarray ? @rval : "<tr><td>PageMeta</td><td>@rval</td></tr>\n" ;
591}
592
593# turns LargeCatFish into Large,Cat,Fish so MG sees the separate words
594sub split_filepath {
595 my ($self, $filepath) = (@_);
596 my (@words) = $filepath =~ /([A-Z][a-z]+)/g;
597 return join(',', @words);
598}
599
600# finds and extracts sentences
601# that seem to be on the same topic
602# as other related text (correlations)
603# and textual references (e.g. in figure 3 ...)
604sub get_textrefs {
605 my ($self, $reltext, $textref, $prevpos, $pos, $nextpos) = (@_);
606 my ($maxtext, $mintext, $startpos, $context_size, $context);
607
608 my (@relwords, @refwords, %sentences, @pagemeta);
609
610 # extract larger context
611 $maxtext = $self->{'maxtext'};
612 $startpos = $pos - ($maxtext * 4);
613 $context_size = $maxtext*10;
614 if ($startpos < $prevpos ) { $startpos = $prevpos }
615 if ($nextpos != -1 && $context_size > ( $nextpos - $startpos )) { $context_size = ($nextpos - $startpos) }
616 $context = substr ( $$textref, $startpos, $context_size );
617 $context =~ s/<.*?>//gs;
618 $context =~ s/^.*>(.*)/$1/gs;
619 $context =~ s/(.*)<.*$/$1/gs;
620
621 # get page meta-data (if not already included)
622 if ( $self->{'aggressiveness'} == 5 && ! $self->{'smallpage'} ) {
623 @pagemeta = $self->get_page_metadata($textref);
624 foreach $value ( @pagemeta ) {
625 $context .= "$value."; # make each into psuedo-sentence
626 }
627 }
628
629 # TODO: this list is not exhaustive
630 @refwords = ( '(?:is|are)? ?(?:show(?:s|n)|demonstrate(?:d|s)|explains|features) (?:in|by|below|above|here)',
631 '(?:see)? (?:figure|table)? (?:below|above)');
632
633 # extract general references
634 foreach $rw ( @refwords ) {
635 while ( $context =~ /[\.\?\!\,](.*?$rw\W.*?[\.\?\!\,])/ig ) {
636 $sentence = $1;
637 $sentence =~ s/\s+/ /g;
638 $sentences{$sentence}+=2;
639 }
640 }
641 # extract specific (figure, table) references by number
642 my ($fignum) = $context =~ /[\.\?\!].*?(?:figure|table)s?[\-\_\ \.](\d+\w*)\W.*?[\.\?\!]/ig;
643 if ( $fignum ) {
644 foreach $rw ( @refwords ) {
645 while ( $context =~ /[\.\?\!](.*?(figure|table)[\-\_\ \.]$fignum\W.*?[\.\?\!])/ig ) {
646 $sentence = $1;
647 $sentence =~ s/\s+/ /g;
648 $sentences{$sentence}+=4;
649 }
650 }
651 }
652
653 # sentences with occurances of important words
654 @relwords = $reltext =~ /([a-zA-Z]{4,})/g; # take out small words
655 foreach $word ( @relwords ) {
656 if ( $self->{'stopwords'}{$word} ) { next } # skip stop words
657 while ( $context =~ /([^\.\?\!]*?$word\W.*?[\.\?\!])/ig ) {
658 $sentence = $1;
659 $sentence =~ s/\s+/ /g;
660 $sentences{$sentence}++;
661 }
662 }
663 foreach $sentence ( keys %sentences ) {
664 if ($sentences{$sentence} < $self->{'textref_threshold'}) {
665 delete $sentences{$sentence};
666 }
667 }
668 my ($rval) = join "<br>\n", (keys %sentences);
669 if ( $rval && length($rval) > 5 ) {
670 return ( "<tr><td>TextualReferences</td><td>" . $rval . "</td></tr>\n") }
671 else { return "" }
672}
673
674# handles caption extraction
675# calling the extractor with different
676# tags and choosing the best candidate caption
677sub extract_caption_text {
678 my ($self, $tag, $textref, $prevpos, $pos, $nextpos) = (@_);
679 my (@neartext, $len, $hdelim, $goodlen,
680 $startpos, $context, $context_size);
681
682 $mintext = $self->{'mintext'};
683 $goodlen = $self->{'caption_len'};
684
685 # extract a context to extract near text from (faster)
686 $context_size = $self->{'maxtext'}*3;
687 $startpos = $pos - ($context_size / 2);
688 if ($startpos < $prevpos ) { $startpos = $prevpos }
689 if ($nextpos != -1 && $context_size > ( $nextpos - $startpos ))
690 { $context_size = ($nextpos - $startpos) }
691
692 $context = substr ( $$textref, $startpos, $context_size );
693 $context =~ s/<!--.*?-->//gs;
694 $context =~ s/^.*-->(.*)/$1/gs;
695 $context =~ s/(.*)<!--.*$/$1/gs;
696
697 # try stepping through markup delimiter sets
698 # and selecting the best one
699 foreach $hdelim ( @{ $self->{'cdelims'} } ) {
700 @neartext = $self->extract_caption($tag, $hdelim, \$context);
701 $len = length(join("", @neartext));
702 last if ($len >= $mintext && $len <= $goodlen);
703 }
704 # reject if well over reasonable length
705 if ( $len > $goodlen ) {
706 @neartext = [];
707 }
708 $neartext[0] = " " if (! defined $neartext[0]);
709 $neartext[1] = " " if (! defined $neartext[1]);
710 return "<tr><td>Caption</td><td>" . (join ",", @neartext) . "</td></tr>\n"; # TODO: the | is for testing purposes
711} # end extract_caption_text
712
713# the previous section header often gives a bit
714# of context to the section that the image is
715# in (invariably the header is before/above the image)
716# so extract the text of the closest header above the image
717#
718# this fn just gets all the headers above the image, within the context window
719sub get_prev_header {
720 my ($self, $pos, $textref) = (@_);
721 my ($rhtext);
722 while ( $$textref =~ /<h\d>(.*?)<\/h\d>/sig ) {
723 # only headers before image
724 if ((pos $$textref) < $pos) {
725 $rhtext .= "$1, ";
726 }
727 }
728 if ( $rhtext ) { return "Header($rhtext)" }
729 else { return "" }
730}
731
732# not the most robust tag stripping
733# regexps (see perl.com FAQ) but good enough
734#
735# used by caption & tag-based near text algorithms
736sub strip_tags {
737 my ( $self, $value ) = @_;
738 if ( ! defined($value) ) { $value = "" } # handle nulls
739 else {
740 $value =~ s/<.*?>//gs; # strip all html tags
741 $value =~ s/\s+/\ /g; # remove extra whitespace
742 $value =~ s/\&\w+\;//g; # remove &nbsp; etc
743 }
744 return $value;
745}
746
747# uses the given tag(s) to identify
748# the caption near to the image
749# (below, above or both below and above)
750sub extract_caption {
751 my ($self, $tag, $bound_tag, $contextref) = (@_);
752 my (@nt, $n, $etag, $gotcap);
753 return ("", "") if ( ! ($$contextref =~ /\Q$tag/) );
754
755 $nt[0] = $`;
756 $nt[1] = $';
757 $gotcap = 0;
758
759 # look before the image for a boundary tag
760 ($etag, $nt[0]) = $nt[0] =~ /<($bound_tag)[\s]?.*?>(.*?)$/is;
761 # if bound_tag too far from the image, then prob not caption
762 # (note: have to allow for tags, so multiply by 3
763 if ( $etag && length($nt[0]) < ($self->{'caption_len'} * 3) ) {
764 if ( $nt[0] =~ /<\/$etag>/si ) {
765 # the whole caption is above the image: <tag>text</tag><img>
766 ($nt[0]) =~ /<(?:$etag)[\s]?.*?>(.*?)<\/$etag>/is;
767 $nt[0] = $self->strip_tags($nt[0]);
768 if ( length($nt[0]) > $self->{'mintext'} ) {
769 $gotcap = 1;
770 $nt[1] = "";
771 }
772
773 } elsif ( $nt[1] =~ /<\/$etag>/si) {
774 # the caption tag covers image: <tag>text?<img>text?</tag>
775 ($nt[1]) = $nt[1] =~ /(.*?)<\/$etag>/si;
776 $nt[0] = $self->strip_tags($nt[0] . $nt[1]);
777 if ( length($nt[0]) > $self->{'mintext'} ) {
778 $gotcap = 2;
779 $nt[1] = "";
780 }
781 }
782 }
783 # else try below the image
784 if ( ! $gotcap ) {
785 # the caption is after the image: <img><tag>text</tag>
786 ($etag, $nt[1]) = $nt[1] =~ /^.*?<($bound_tag)[\s]?.*?>(.*)/is;
787 if ( $etag && $nt[1] =~ /<\/$etag>/s) {
788 ($nt[1]) = $nt[1] =~ /(.*?)<\/$etag>/si;
789 $gotcap = 3;
790 $nt[0] = "";
791 $nt[1] = $self->strip_tags($nt[1]);
792 }
793 }
794 if ( ! $gotcap ) { $nt[0] = $nt[1] = "" }
795 else {
796 # strip part-tags
797 $nt[0] =~ s/^.*>//s;
798 $nt[1] =~ s/<.*$//s;
799 }
800 my ($type);
801 if ( $gotcap == 0 ) { return ("nocaption", "") }
802 elsif ( $gotcap == 1 ) { $type = "captionabove:" }
803 elsif ( $gotcap == 2 ) { $type = "captioncovering:" }
804 elsif ( $gotcap == 3 ) { $type = "captionbelow:" }
805 return ($type, $nt[0], $nt[1]);
806}
807
808# tag-based near text
809#
810# tries different tag sets
811# and chooses the best one
812sub extract_near_text {
813 my ($self, $tag, $textref, $prevpos, $pos, $nextpos) = (@_);
814 my (@neartext, $len, $hdelim, $maxtext, $mintext, $goodlen,
815 @bestlen, @best, $startpos, $context, $context_size,
816 $dist, $bdist, $best1, $i, $nt);
817 $bestlen[0] = $bestlen[1] = 0; $bestlen[2] = $bdist = 999999;
818 $best[0] = $best[1] = $best[2] = "";
819 $maxtext = $self->{'maxtext'};
820 $mintext = $self->{'mintext'};
821 $goodlen = $self->{'neartext_len'};
822
823 # extract a context to extract near text from (faster)
824 $context_size = $maxtext*4;
825 $startpos = $pos - ($context_size / 2);
826 if ($startpos < $prevpos ) { $startpos = $prevpos }
827 if ($nextpos != -1 && $context_size > ( $nextpos - $startpos ))
828 { $context_size = ($nextpos - $startpos) }
829 $context = substr ( $$textref, $startpos, $context_size );
830 $context =~ s/<!--.*?-->//gs;
831 $context =~ s/^.*-->(.*)/$1/gs;
832 $context =~ s/(.*)<!--.*$/$1/gs;
833
834 # try stepping through markup delimiter sets
835 # and selecting the best one
836 foreach $hdelim ( @{ $self->{'delims'} } ) {
837 @neartext = $self->extract_tagged_neartext($tag, $hdelim, \$context);
838 $nt = join("", @neartext);
839 $len = length($nt);
840 # Priorities:
841 # 1. Greater than mintext
842 # 2. Less than maxtext
843 # 3. Closest to goodlen
844 if ( $len <= $goodlen && $len > $bestlen[0] ) {
845 $bestlen[0] = $len;
846 $best[0] = $hdelim;
847 } elsif ( $len >= $maxtext && $len < $bestlen[2] ) {
848 $bestlen[2] = $len;
849 $best[2] = $hdelim;
850 } elsif ( $len >= $bestlen[0] && $len <= $bestlen[2] ) {
851 $dist = abs($goodlen - $len);
852 if ( $dist < $bdist ) {
853 $bestlen[1] = $len;
854 $best[1] = $hdelim;
855 $bdist = $dist;
856 }
857 }
858 }
859 $best1 = 2;
860 foreach $i ( 0..2 ) {
861 if ( $bestlen[$i] == 999999 ) { $bestlen[$i] = 0 }
862 $dist = abs($goodlen - $bestlen[$i]);
863 if ( $bestlen[$i] > $mintext && $dist <= $bdist ) {
864 $best1 = $i;
865 $bdist = $dist;
866 }
867 }
868 @neartext = $self->extract_tagged_neartext($tag, $best[$best1], \$context);
869 if ( $bestlen[$best1] > $maxtext ) {
870 # truncate on word boundary if too much text
871 my $hmax = $maxtext / 2;
872 ($neartext[0]) = $neartext[0] =~ /([^\s]*.{1,$hmax})$/s;
873 ($neartext[1]) = $neartext[1] =~ /^(.{1,$hmax}[^\s]*)/s;
874 } elsif ( $bestlen[$best1] < $mintext ) {
875 # use plain text extraction if tags failed (e.g. usable tag outside context)
876 print {$self->{'outhandle'}} "W3ImgPlug: Fallback to plain-text extraction for $tag\n"
877 if $self->{'verbosity'} > 2;
878 $neartext[0] = "<tr><td>RawNeartext</td><td>" . $self->extract_raw_neartext($tag, $textref) . "</td></tr>";
879 $neartext[1] = "";
880 }
881 # get previous header if available
882 $neartext[0] .= "<br>\n" .
883 $self->get_prev_header($pos, \$context) if ( $self->{'aggressiveness'} >= 4 );
884 $neartext[0] = " " if (! defined $neartext[0]);
885 $neartext[1] = " " if (! defined $neartext[1]);
886
887 return "<tr><td>NearText</td><td>" . (join "|", @neartext) . "</td></tr>\n"; # TODO: the | is for testing purposes
888} # end extract_near_text
889
890# actually captures tag-based
891# near-text given a tag set
892sub extract_tagged_neartext {
893 my ($self, $tag, $bound_tag, $textref) = (@_);
894 return "" if ( ! ($$textref =~ /\Q$tag/) );
895 my (@nt, $delim, $pre_tag, $n);
896 $nt[0] = $`;
897 $nt[1] = $';
898
899 # get text after previous image tag
900 $nt[0] =~ s/.*<($bound_tag)[^>]*>(.*)/$2/is; # get rid of preceding text
901 if (defined($1)) { $delim = $1 }
902 $pre_tag = $bound_tag;
903
904 if (defined($delim)) {
905 # we want to try and use the end tag of the previous delimiter
906 # (put it on the front of the list)
907 $pre_tag =~ s/(^|\|)($delim)($|\|)//i; # take it out
908 $pre_tag =~ s/\|\|/\|/i; # replace || with |
909 $pre_tag = $delim . "|" . $pre_tag; # put it on the front
910 }
911
912 # get text before next image tag
913 $nt[1] =~ s/<\/?(?:$pre_tag)[^>]*>.*//is; # get rid of stuff after first delimiter
914
915 # process related text
916 for $n (0..1) {
917 if ( defined($nt[$n]) ) {
918 $nt[$n] =~ s/<.*?>//gs; # strip all html tags
919 $nt[$n] =~ s/\s+/\ /gs; # remove extra whitespace
920 $nt[$n] =~ s/\&\w+\;//sg; # remove &nbsp; etc
921 # strip part-tags
922 if ( $n == 0 ) { $nt[0] =~ s/^.*>//s }
923 if ( $n == 1 ) { $nt[1] =~ s/<.*$//s }
924 } else { $nt[$n] = ""; } # handle nulls
925 }
926 return @nt;
927}
928
929# this function is fall-back
930# if tags aren't suitable.
931#
932# extracts a fixed length of characters
933# either side of image tag (on word boundary)
934sub extract_raw_neartext {
935 my ($self, $tag, $textref) = (@_);
936 my ($rawtext, $startpos, $fp);
937 my $imgs = \%{$self->{'imglist'}};
938 ($fp) = $tag =~ /([\w\\\/]+\.(?:gif|jpe?g|png))/is;
939 if (! $fp) { return " " };
940 # if the cached, plain-text version isn't there, then create it
941 $self->init_plaintext($textref) unless defined($self->{'plaintext'});
942
943 # take the closest maxtext/2 characters
944 # either side of the tag (by word boundary)
945 return "" if ( ! exists $imgs->{$fp}{'rawpos'} );
946 $startpos = $imgs->{$fp}{'rawpos'} - (($self->{'maxtext'} / 2) + 20);
947 if ( $startpos < 0 ) { $startpos = 0 }
948 $rawtext = substr $self->{'plaintext'}, $startpos, $self->{'maxtext'} + 20;
949 $rawtext =~ s/\s\s/ /g;
950
951 return $rawtext;
952}
953
954# init plaintext variable for HTML-stripped version
955# (for full text index/raw assoc text extraction)
956sub init_plaintext {
957 my ($self, $textref) = (@_);
958 my ($page, $fp);
959 my $imgs = \%{$self->{'imglist'}};
960 $page = $$textref; # make a copy of original
961
962 # strip tags around image filenames so they don't get zapped
963 $page =~ s/<\w+\s+.*?([\w\/\\]+\.(?:gif|jpe?g|png))[^>]*>/\"$1\"/gsi;
964 $page =~ s/<.*?>//gs;
965 $page =~ s/&nbsp;/ /gs;
966 $page =~ s/&amp;/&/gs; #TODO: more &zzz; replacements (except &lt;, $gt;)
967
968 # get positions and strip images
969 while ( $page =~ /([^\s\'\"]+\.(jpe?g|gif|png))/ig ) {
970 $fp = $1;
971 if ( $imgs->{$fp}{'exists'} ) {
972 $imgs->{$fp}{'rawpos'} = pos $page;
973 }
974 $page =~ s/\"$fp\"//gs;
975 }
976 $self->{'plaintext'} = $page;
977}
978
979# finds and filters images based on size
980# (dimensions, height, filesize) and existence
981#
982# looks for image filenames (.jpg, .gif, etc)
983# and checks for existence on disk
984# (hence supports most JavaScript images)
985sub get_img_list {
986 my $self = shift (@_);
987 my ($textref) = (@_);
988 my ($filepath, $relpath, $abspath, $pos, $num, $width, $height, $filesize);
989 my $imgs = \%{$self->{'imglist'}};
990 while ( $$textref =~ /([^\s\'\"]+\.(jpe?g|gif|png))/ig ) {
991 $filepath = $1;
992 $pos = pos $$textref;
993 next if ( $imgs->{$filepath}{'relpath'} );
994 $relpath = $filepath;
995 $relpath =~ s/^http\:\/\///; # remove http:// in case we have mirrored it
996 $relpath =~ s/\\/\//g; # replace \ with /
997 $relpath =~ s/^\.\///s; # make "./filepath" into "filepath"
998 $imgs->{$filepath}{'relpath'} = $relpath;
999 $abspath = "$self->{'htpath'}/$relpath";
1000
1001 if (! -e $abspath) { next }
1002
1003 # can't modify real filepath var because it
1004 # then can't be located in the page for tag recognition later
1005 ($width, $height) =
1006 `identify $abspath -ping -format "%wx%h"` =~ /^(\d*)x(\d*)$/m;
1007 if (! ($width && $height)) {
1008 print STDERR "W3ImgPlug: ($abspath) 'identify' failed. Check ImageMagicK binaries are installed and working correctly\n"; next;
1009 }
1010 $filesize = (-s $abspath);
1011 if ( $filesize >= $self->{'min_img_filesize'}
1012 && ( $width >= $self->{'min_img_width'} )
1013 && ( $height >= $self->{'min_img_height'} ) ) {
1014
1015 $imgs->{$filepath}{'exists'} = 1;
1016 $imgs->{$filepath}{'pos'} = $pos;
1017 $imgs->{$filepath}{'width'} = $width;
1018 $imgs->{$filepath}{'height'} = $height;
1019 $imgs->{$filepath}{'filesize'} = $filesize;
1020 } else {
1021 print {$self->{'outhandle'}} "W3ImgPlug: skipping $self->{'base_path'}/$relpath: $filesize, $width x $height\n"
1022 if $self->{'verbosity'} > 2;
1023 }
1024 }
1025 $num = 0;
1026 foreach $i ( keys %{$imgs} ) {
1027 if ( $imgs->{$i}{'pos'} ) {
1028 $num++;
1029 } else { delete $imgs->{$i} }
1030 }
1031 return $num;
1032}
1033
1034# make the text available to the read function
1035# by making it an object variable
1036sub read_file {
1037 my ($self, $filename, $encoding, $language, $textref) = @_;
1038 $self->SUPER::read_file($filename, $encoding, $language, $textref);
1039
1040 # if HTMLplug has run through, then it will
1041 # have replaced references so we have to
1042 # make a copy of the text before processing
1043 if ( $self->{'index_pages'} ) {
1044 $self->{'text'} = $$textref;
1045 $self->{'textref'} = \($self->{'text'});
1046 } else {
1047 $self->{'textref'} = $textref;
1048 }
1049 $self->{'plaintext'} = undef;
1050}
1051
1052# HTMLPlug only extracts meta-data if it is specified in plugin options
1053# hence a special function to do it here
1054sub get_meta_value {
1055 my ($self, $name, $textref) = @_;
1056 my ($value);
1057 $name = lc $name;
1058 if ($name eq "title") {
1059 ($value) = $$textref =~ /<title>(.*?)<\/title>/is
1060 } else {
1061 my $qm = "(?:\"|\')";
1062 ($value) = $$textref =~ /<meta name\s*=\s*$qm?$name$qm?\s+content\s*=\s*$qm?(.*?)$qm?\s*>/is
1063 }
1064 $value = "" unless $value;
1065 return $value;
1066}
1067
1068# make filename an anchor reference
1069# so we can go straight to the image
1070# within the cached version of the source page
1071# (augment's HTMLPlug sub)
1072sub replace_images {
1073 my $self = shift (@_);
1074 my ($front, $link, $back, $base_dir,
1075 $file, $doc_obj, $section) = @_;
1076 $link =~ s/\"//g;
1077 my ($a_name) = $link;
1078 $a_name =~ s/[\/\\\:\&]/_/g;
1079 # keep a list so we don't repeat the same anchor
1080 if ( ! $self->{'imglist'}{$link}{'anchored'} ) {
1081 $front = "<a name=\"gsdl_$a_name\">$front";
1082 $back = "$back</a>";
1083 $self->{'imglist'}{$link}{'anchored'} = 1;
1084 }
1085 return $self->SUPER::replace_images($front, $link, $back, $base_dir,
1086 $file, $doc_obj, $section);
1087}
1088
10891;
Note: See TracBrowser for help on using the repository browser.