aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2014-09-16 09:37:41 +0100
committerSimon McVittie <smcv@debian.org>2014-09-16 10:00:40 +0100
commiteb4945a3bc03bf062f59006cbed11b03526cefbb (patch)
treeb052eca64fcddfb9bdf7543993b8b28f2fd26921
parent526a463ae55b36d9713212861c674bc4ccb4b263 (diff)
downloadikiwiki-eb4945a3bc03bf062f59006cbed11b03526cefbb.tar
ikiwiki-eb4945a3bc03bf062f59006cbed11b03526cefbb.tar.gz
img: raise an error if we cannot find the image's size
This happens for PDFs without ghostscript installed, for instance.
-rw-r--r--IkiWiki/Plugin/img.pm6
1 files changed, 5 insertions, 1 deletions
diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm
index 54c13d069..17a58ca7a 100644
--- a/IkiWiki/Plugin/img.pm
+++ b/IkiWiki/Plugin/img.pm
@@ -78,7 +78,11 @@ sub preprocess (@) {
my $imgdatalink;
my $r = $im->Read("$srcfile\[$pagenumber]");
error sprintf(gettext("failed to read %s: %s"), $file, $r) if $r;
-
+
+ if (! defined $im->Get("width") || ! defined $im->Get("height")) {
+ error sprintf(gettext("failed to get dimensions of %s"), $file);
+ }
+
my ($dwidth, $dheight);
if ($params{size} eq 'full') {