+ img_allowed_formats => {
+ type => "string",
+ default => [qw(jpeg png gif)],
+ description => "Image formats to process (jpeg, png, gif, pdf, svg or 'everything' to accept all)",
+ # ImageMagick has had arbitrary code execution flaws,
+ # and the whole delegates mechanism is scary from
+ # that perspective
+ safe => 0,
+ rebuild => 0,
+ },
+}
+
+sub allowed {
+ my $format = shift;
+ my $allowed = $config{img_allowed_formats};
+ $allowed = ['jpeg', 'png'] unless defined $allowed && @$allowed;
+
+ foreach my $a (@$allowed) {
+ return 1 if $a eq $format || $a eq 'everything';
+ }
+
+ return 0;