| 1 | package Image::Processor::Create::HTML; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use base ('Image::Processor::Base'); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use Text::Template; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 0 | ▶ | sub table_columns { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
table_columns: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 0 | my ($self,$set) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 9 | 0 | ▶ | $self->{'table_columns'} ||= '4'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{"table_columns"} ||= 4
MC/DC0%0/1
$self->{"table_columns"} ||= 4
$self->{"table_columns"}
Truth table0%0/2
A
A= $self->{"table_columns"}
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 0 | ▶ | return $self->{'table_columns'} if !$set; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 0 | $self->{'table_columns'} = $set; | |||||||||||||||||||||||||||||||||||||||||
| 12 | } | ||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 0 | ▶ | sub create_thumbnails_html { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_thumbnails_html: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | my ($self,$vars) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 16 | #thumb_suffix => $sm_suffix, | ||||||||||||||||||||||||||||||||||||||||||
| 17 | #full_suffix => $full_suffix, | ||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | if ( | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$vars->{"thumb_suffix"} eq "" and $vars->{"full_suffix"} eq "" and not $vars->{"is_custom"}
$vars->{"thumb_suffix"} eq "" and $vars->{"full_suffix"} eq ""
MC/DC0%0/3
$vars->{"thumb_suffix"} eq "" and $vars->{"full_suffix"} eq "" and not $vars->{"is_custom"}
$vars->{"thumb_suffix"} eq ""
$vars->{"full_suffix"} eq ""
not $vars->{"is_custom"}
Truth table0%0/4
A and B and not(C)
A= $vars->{"thumb_suffix"} eq ""B= $vars->{"full_suffix"} eq ""C= not $vars->{"is_custom"}
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | ($vars->{'thumb_suffix'} eq '' && | ||||||||||||||||||||||||||||||||||||||||||
| 20 | $vars->{'full_suffix'} eq '') | ||||||||||||||||||||||||||||||||||||||||||
| 21 | && !$vars->{'is_custom'}) { | ||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | $self->graceful_exit->(qq~ | |||||||||||||||||||||||||||||||||||||||||
| 24 | I didn't get all the parameters | ||||||||||||||||||||||||||||||||||||||||||
| 25 | I need for 'create_thumbnails_html' | ||||||||||||||||||||||||||||||||||||||||||
| 26 | It requires the suffix for the thumbnails | ||||||||||||||||||||||||||||||||||||||||||
| 27 | and the "full" picture. | ||||||||||||||||||||||||||||||||||||||||||
| 28 | ~); | ||||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | print "Creating HTML page for thumbnails\n"; | |||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | my $template = Text::Template->new(TYPE => 'STRING', SOURCE => $self->thumbnail_template); | |||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | $vars->{ 'image_list' } = $self->image_list(); | |||||||||||||||||||||||||||||||||||||||||
| 36 | 0 | $vars->{ 'orderid' } = $self->{'orderid'}; | |||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | $vars->{ 'columns' } = $self->table_columns(); | |||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | my $result = $template->fill_in(HASH => $vars); | |||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | open(FULL,">" . $self->output_directory() . "/thumbnail.html") or die "$!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | print FULL $result; | |||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | close FULL; | |||||||||||||||||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | sub create_index_html { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create_index_html: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | my $number_of_photos = @{$self->image_list()}; | |||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | print "Creating HTML page for index\n"; | |||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | my $template = Text::Template->new( | |||||||||||||||||||||||||||||||||||||||||
| 52 | TYPE => 'STRING', | ||||||||||||||||||||||||||||||||||||||||||
| 53 | SOURCE => $self->index_template | ||||||||||||||||||||||||||||||||||||||||||
| 54 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | my %vars = ( | ||||||||||||||||||||||||||||||||||||||||||
| 57 | orderid => $self->{'orderid'}, | ||||||||||||||||||||||||||||||||||||||||||
| 58 | number_of_photos => $number_of_photos, | ||||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | date => $self->{'date'} || 'Unkown', | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'date'} || 'Unkown'
MC/DC0%0/1
$self->{'date'} || 'Unkown'
$self->{'date'}
Truth table0%0/2
A
A= $self->{'date'}
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | my $html = $template->fill_in(HASH => \%vars); | |||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | open(INDEX,">" . $self->output_directory() . "/index.html") or die "$!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | print INDEX $html; | |||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | close INDEX; | |||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | sub index_template { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
index_template: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | my ($self,$set) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | ▶ | if ($set) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | $self->{'index_template'} = $set; | |||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | return $self->{'index_template'} || <<"EOF"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'index_template'} || qq[ <html>\n <head>\n <title>Index for CD number {\$orderid}</title>\n </head>\n <body>\n This image archive has {\$number_of_photos} photos in it.<br>\n The source CD was created on {\$date}<br>\n <br>\n<a href="thumbnail.html">Show all photos as thumbnails</a><br>\n </body>\n</html>\n\n]
MC/DC0%0/1
$self->{'index_template'} || qq[ <html>\n <head>\n <title>Index for CD number {\$orderid}</title>\n </head>\n <body>\n This image archive has {\$number_of_photos} photos in it.<br>\n The source CD was created on {\$date}<br>\n <br>\n<a href="thumbnail.html">Show all photos as thumbnails</a><br>\n </body>\n</html>\n\n]
$self->{'index_template'}
Truth table0%0/2
A
A= $self->{'index_template'}
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | <html> | ||||||||||||||||||||||||||||||||||||||||||
| 79 | <head> | ||||||||||||||||||||||||||||||||||||||||||
| 80 | <title>Index for CD number {\$orderid}</title> | ||||||||||||||||||||||||||||||||||||||||||
| 81 | </head> | ||||||||||||||||||||||||||||||||||||||||||
| 82 | <body> | ||||||||||||||||||||||||||||||||||||||||||
| 83 | This image archive has {\$number_of_photos} photos in it.<br> | ||||||||||||||||||||||||||||||||||||||||||
| 84 | The source CD was created on {\$date}<br> | ||||||||||||||||||||||||||||||||||||||||||
| 85 | <br> | ||||||||||||||||||||||||||||||||||||||||||
| 86 | <a href="thumbnail.html">Show all photos as thumbnails</a><br> | ||||||||||||||||||||||||||||||||||||||||||
| 87 | </body> | ||||||||||||||||||||||||||||||||||||||||||
| 88 | </html> | ||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | EOF | ||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | ▶ | sub thumbnail_template { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
thumbnail_template: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | my ($self,$set) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | ▶ | if ($set) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | $self->{'thumbnail_template'} = $set; | |||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | return $self->{'thumbnail_template'} || <<"EOF"; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'thumbnail_template'} || qq[<html>\n <head>\n <title>Thumbnails of Images from {\$orderid}</title>\n </head>\n <body>\n <a href="../">Return to the Album List</a><br>\n <a href="">Return to Album opening page</a><br>\n \n <table align="center">\n <tr>\n { my \$count = 1;\n my \$html = '';\n foreach my \$file (\@image_list) {\n \$html .= qq~\n <td valign="center" align="center"><a href="\$full_suffix\$file"><img src="\$thumb_suffix\$file"></a><td>~;\n if (\$count % \$columns == 0) { \$html .= qq~\n </tr>\n <tr>~; }\n \$count ++;\n }\n \$html \n }\n </tr>\n </table>\n </body>\n</html>\n\n]
MC/DC0%0/1
$self->{'thumbnail_template'} || qq[<html>\n <head>\n <title>Thumbnails of Images from {\$orderid}</title>\n </head>\n <body>\n <a href="../">Return to the Album List</a><br>\n <a href="">Return to Album opening page</a><br>\n \n <table align="center">\n <tr>\n { my \$count = 1;\n my \$html = '';\n foreach my \$file (\@image_list) {\n \$html .= qq~\n <td valign="center" align="center"><a href="\$full_suffix\$file"><img src="\$thumb_suffix\$file"></a><td>~;\n if (\$count % \$columns == 0) { \$html .= qq~\n </tr>\n <tr>~; }\n \$count ++;\n }\n \$html \n }\n </tr>\n </table>\n </body>\n</html>\n\n]
$self->{'thumbnail_template'}
Truth table0%0/2
A
A= $self->{'thumbnail_template'}
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | <html> | ||||||||||||||||||||||||||||||||||||||||||
| 103 | <head> | ||||||||||||||||||||||||||||||||||||||||||
| 104 | <title>Thumbnails of Images from {\$orderid}</title> | ||||||||||||||||||||||||||||||||||||||||||
| 105 | </head> | ||||||||||||||||||||||||||||||||||||||||||
| 106 | <body> | ||||||||||||||||||||||||||||||||||||||||||
| 107 | <a href="../">Return to the Album List</a><br> | ||||||||||||||||||||||||||||||||||||||||||
| 108 | <a href="">Return to Album opening page</a><br> | ||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | <table align="center"> | ||||||||||||||||||||||||||||||||||||||||||
| 111 | <tr> | ||||||||||||||||||||||||||||||||||||||||||
| 112 | { my \$count = 1; | ||||||||||||||||||||||||||||||||||||||||||
| 113 | my \$html = ''; | ||||||||||||||||||||||||||||||||||||||||||
| 114 | foreach my \$file (\@image_list) { | ||||||||||||||||||||||||||||||||||||||||||
| 115 | \$html .= qq~ | ||||||||||||||||||||||||||||||||||||||||||
| 116 | <td valign="center" align="center"><a href="\$full_suffix\$file"><img src="\$thumb_suffix\$file"></a><td>~; | ||||||||||||||||||||||||||||||||||||||||||
| 117 | if (\$count % \$columns == 0) { \$html .= qq~ | ||||||||||||||||||||||||||||||||||||||||||
| 118 | </tr> | ||||||||||||||||||||||||||||||||||||||||||
| 119 | <tr>~; } | ||||||||||||||||||||||||||||||||||||||||||
| 120 | \$count ++; | ||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||
| 122 | \$html | ||||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | </tr> | ||||||||||||||||||||||||||||||||||||||||||
| 125 | </table> | ||||||||||||||||||||||||||||||||||||||||||
| 126 | </body> | ||||||||||||||||||||||||||||||||||||||||||
| 127 | </html> | ||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | EOF | ||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||