X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/30b101e6e8ffa5d02af9b44bfb9abdc2f2a84547..54095ea655b63ab8f2cefba43622df683f89e4fe:/IkiWiki/Plugin/img.pm diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm index 79cfba20f..b85824345 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");