Changeset 11917


Ignore:
Timestamp:
2006-06-09T16:55:52+12:00 (18 years ago)
Author:
mdewsnip
Message:

Added support for PDFs as place images: these aren't converted, just associated and linked to directly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cic-hcap/perllib/plugins/CICPlug.pm

    r11916 r11917  
    599599    while (my $place_images_match_hashref = $place_images_sql_handle->fetchrow_hashref) {
    600600        my $place_image_location = $place_images_match_hashref->{"Location"};
    601         $self->generate_place_image_variant($place_doc_obj, $place_image_location, "small");
    602         $self->generate_place_image_variant($place_doc_obj, $place_image_location, "large");
    603 
    604601        my $place_image_name = $place_images_match_hashref->{"FileName"};
    605         if (defined($place_image_name)) {
    606         my $place_image_large_file_name = $place_image_name . "-large.jpg";
    607         $place_image_large_file_name =~ s/ /%20/g;
    608         my $place_image_large_file_link = "_httpcollection_/index/assoc/[assocfilepath]/$place_image_large_file_name";
    609         my $place_image_small_file_name = $place_image_name . "-small.jpg";
    610         $place_image_small_file_name =~ s/ /%20/g;
    611         my $place_image_small_file_link = "_httpcollection_/index/assoc/[assocfilepath]/$place_image_small_file_name";
    612         $place_images_html .= "<tr><td valign=\"top\"><a href=\"$place_image_large_file_link\"><img src=\"$place_image_small_file_link\"/></a></td><td valign=\"top\"><a href=\"$place_image_large_file_link\"><span class=\"cictext\">$place_image_name</span></a></td></tr>\n";
     602
     603        # Deal with PDF files separately: don't convert, just associate
     604        if ($place_image_location =~ /\.pdf$/i) {
     605        # Convert the server location of the PDF file into the local location of the file
     606        my $place_pdf_file_path = $place_image_location;
     607        $place_pdf_file_path =~ s/^[A-Z]:/$self->{'images_directory'}/;
     608 
     609        if (-f $place_pdf_file_path) {
     610            my ($place_pdf_file_name) = ($place_pdf_file_path =~ /^.+\\(.+)$/);
     611            $place_doc_obj->associate_file($place_pdf_file_path, $place_pdf_file_name, undef, $place_doc_obj->get_top_section());
     612
     613            $place_pdf_file_name =~ s/ /%20/g;
     614            my $place_pdf_file_link = "_httpcollection_/index/assoc/[assocfilepath]/$place_pdf_file_name";
     615            $place_images_html .= "<tr><td align=\"right\" valign=\"top\"><a href=\"$place_pdf_file_link\">_iconpdf_</a></td><td valign=\"top\"><a href=\"$place_pdf_file_link\"><span class=\"cictext\">$place_image_name (PDF)</span></a></td></tr>\n";
     616        }
     617        else {
     618            print STDERR "<ProcessingError n='$place_pdf_file_path' p='CICPlug' r='Does not exist'>\n" if ($self->{'gli'});
     619            print STDERR "Error: File $place_pdf_file_path does not exist.\n";
     620            print $fail_log_handle "Error: File $place_pdf_file_path does not exist.\n";
     621        }
    613622        }
    614623        else {
    615         $place_images_html .= "<tr><td valign=\"top\"><img src=\"_httpcollection_/images/no_image.jpg\"/></td><td valign=\"top\"><span class=\"cictext\">&nbsp;</span></td></tr>\n";
     624        $self->generate_place_image_variant($place_doc_obj, $place_image_location, "small");
     625        $self->generate_place_image_variant($place_doc_obj, $place_image_location, "large");
     626
     627        if (defined($place_image_name)) {
     628            my $place_image_large_file_name = $place_image_name . "-large.jpg";
     629            $place_image_large_file_name =~ s/ /%20/g;
     630            my $place_image_large_file_link = "_httpcollection_/index/assoc/[assocfilepath]/$place_image_large_file_name";
     631            my $place_image_small_file_name = $place_image_name . "-small.jpg";
     632            $place_image_small_file_name =~ s/ /%20/g;
     633            my $place_image_small_file_link = "_httpcollection_/index/assoc/[assocfilepath]/$place_image_small_file_name";
     634            $place_images_html .= "<tr><td valign=\"top\"><a href=\"$place_image_large_file_link\"><img src=\"$place_image_small_file_link\"/></a></td><td valign=\"top\"><a href=\"$place_image_large_file_link\"><span class=\"cictext\">$place_image_name</span></a></td></tr>\n";
     635        }
     636        else {
     637            $place_images_html .= "<tr><td valign=\"top\"><img src=\"_httpcollection_/images/no_image.jpg\"/></td><td valign=\"top\"><span class=\"cictext\">&nbsp;</span></td></tr>\n";
     638        }
    616639        }
    617640    }
Note: See TracChangeset for help on using the changeset viewer.