Restructure block from r3000 to make it a bit cleaner.
This commit is contained in:
parent
1162ca6650
commit
58a5c0f52e
1 changed files with 10 additions and 10 deletions
|
|
@ -142,22 +142,22 @@ See WebGUI::Form::File::getValueFromPost() for details. Generates a thumbnail.
|
||||||
sub getValueFromPost {
|
sub getValueFromPost {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $id = $self->SUPER::getValueFromPost(@_);
|
my $id = $self->SUPER::getValueFromPost(@_);
|
||||||
|
|
||||||
if (defined $id) {
|
if (defined $id) {
|
||||||
my $storage = WebGUI::Storage::Image->get($self->session, $id);
|
my $storage = WebGUI::Storage::Image->get($self->session, $id);
|
||||||
if (defined $storage) {
|
if (defined $storage) {
|
||||||
my $atLeastOneImage = 0;
|
my @files = @{$storage->getFiles};
|
||||||
foreach my $file (@{$storage->getFiles}) {
|
my @images = grep{$storage->isImage($_)} @files;
|
||||||
if ($storage->isImage($file)) {
|
if ($self->get('forceImageOnly')) {
|
||||||
$storage->generateThumbnail($file);
|
$storage->deleteFile($_) for grep{!isIn($_, @images)} @files;
|
||||||
$atLeastOneImage = 1;
|
@files = @images;
|
||||||
}
|
|
||||||
elsif ($self->get("forceImageOnly")) {
|
|
||||||
$storage->deleteFile($file);
|
|
||||||
$id = undef unless $atLeastOneImage;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return undef unless @files;
|
||||||
|
$storage->generateThumbnail($_) for @images;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $id;
|
return $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue