2 |
use Moose; |
use Moose; |
3 |
|
|
4 |
extends 'Frey'; |
extends 'Frey'; |
5 |
with 'Frey::Web'; |
with 'Frey::Web', 'Frey::Web::CombineImages', 'Frey::File'; |
|
with 'Frey::Web::CombineImages'; |
|
6 |
|
|
7 |
use Data::Dump qw/dump/; |
use Data::Dump qw/dump/; |
8 |
|
|
26 |
$self->title( 'icons - ' . $self->path ); |
$self->title( 'icons - ' . $self->path ); |
27 |
|
|
28 |
my $extension = '\.(?:png)$'; |
my $extension = '\.(?:png)$'; |
29 |
|
my @icons = $self->dir_extension( $self->path, qr{$extension} ); |
30 |
|
|
31 |
opendir(my $dir, $self->path) || die "can't opendir ", $self->path, ": $!"; |
my ( $combined_path, $styles ) = $self->combine_images( @icons ); |
|
my @icons = sort grep { m/$extension/ } readdir($dir); |
|
|
closedir $dir; |
|
|
|
|
|
my ( $combined_path, $styles ) = $self->combine_images( map { $self->path . '/' . $_ } @icons ); |
|
32 |
|
|
33 |
my $width = 0; |
my $width = 0; |
34 |
foreach ( @icons ) { |
foreach ( @icons ) { |
58 |
|
|
59 |
foreach my $icon ( @icons ) { |
foreach my $icon ( @icons ) { |
60 |
my $name = $icon; |
my $name = $icon; |
61 |
$name =~ s{$extension}{}; |
$name =~ s{^[\w/]*/([^/]+)$extension}{$1}; |
62 |
|
|
63 |
if ( ! $base ) { |
if ( ! $base ) { |
64 |
$base = $name; |
$base = $name; |
87 |
# $html .= qq|<img src="/| . $self->path . qq|/$icon" alt="$icon"> <b>$name</b>$desc<br/>\n|; |
# $html .= qq|<img src="/| . $self->path . qq|/$icon" alt="$icon"> <b>$name</b>$desc<br/>\n|; |
88 |
# $html .= qq|<b>$name</b>$desc<br/>\n|; |
# $html .= qq|<b>$name</b>$desc<br/>\n|; |
89 |
|
|
90 |
my $path = $self->path . '/' . $icon; |
my $path = $icon; |
91 |
|
$path = $self->path . '/' . $icon unless $icon =~ m{[\w/]+/[^/]+$}; |
92 |
|
|
93 |
my $pic = $styles->{$path} || die "can't find pic for $path in ",dump( $styles ); |
my $pic = $styles->{$path} || die "can't find pic for $path in ",dump( $styles ); |
94 |
$html .= '' |
$html .= '' |
104 |
return $html; |
return $html; |
105 |
} |
} |
106 |
|
|
107 |
|
__PACKAGE__->meta->make_immutable; |
108 |
|
no Moose; |
109 |
|
|
110 |
1; |
1; |