summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2021-03-23 17:58:56 +0100
committerJonas Smedegaard <dr@jones.dk>2021-03-23 17:59:31 +0100
commitc73f1cbde0f59287d56bfa603b8fd9a70d7fa2d0 (patch)
tree44974ade8e0bfb149264da279a14751d2868f709 /IkiWiki
parentf32abc6e496219a6df9caa382159bdab0e83f5a2 (diff)
sync with ikiwiki 3.20180228
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/img.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm
index 79cfba2..b858243 100644
--- a/IkiWiki/Plugin/img.pm
+++ b/IkiWiki/Plugin/img.pm
@@ -125,7 +125,14 @@ sub preprocess (@) {
}
else {
# allow ImageMagick to auto-detect (potentially dangerous)
- $format = '';
+ my $im = Image::Magick->new();
+ my $r = $im->Ping(file => $in);
+ if ($r) {
+ $format = lc $r;
+ }
+ else {
+ error sprintf(gettext("failed to determine format of %s"), $file);
+ }
}
error sprintf(gettext("%s image processing disabled in img_allowed_formats configuration"), $format ? $format : "\"$extension\"") unless allowed($format ? $format : "everything");