Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

37 lines (34 sloc) 0.873 kb
CodeDef imagedir Widget 1
CodeDef imagedir Routine <<EOR
use File::Find;
sub {
my ($opt) = @_;
my $dir = delete $opt->{dir} || delete $opt->{outboard};
my $suf = delete $opt->{suffix} || delete $opt->{options};
return undef unless -d $dir;
#::logDebug("passed suf=$suf");
$suf = '\.(GIF|gif|JPG|JPEG|jpg|jpeg|png|PNG)'
unless $suf;
if($suf and $suf !~ /[\.|]/) {
my @types = grep /\S/, split /[,\s\0]+/, $suf;
$suf = '\.(' . join("|", @types) . ')';
}
my @names;
my $regex;
eval {
$regex = qr{$suf$}o;
};
return undef if $@;
my $wanted = sub {
return undef unless -f $_;
return undef unless $_ =~ $regex;
my $n = $File::Find::name;
$n =~ s:^$dir/?::;
push(@names, $n);
};
find($wanted, $dir);
$opt->{passed} = [ sort @names ];
$opt->{type} = delete $opt->{variant} || 'combo';
return Vend::Form::display($opt);
}
EOR
Jump to Line
Something went wrong with that request. Please try again.