]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
img: raise an error if we cannot find the image's size
authorSimon McVittie <smcv@debian.org>
Tue, 16 Sep 2014 08:37:41 +0000 (09:37 +0100)
committerSimon McVittie <smcv@debian.org>
Tue, 16 Sep 2014 09:00:40 +0000 (10:00 +0100)
This happens for PDFs without ghostscript installed, for instance.

IkiWiki/Plugin/img.pm

index 54c13d06919e0858442758d8fec09eb34bf0f0c3..17a58ca7a476b9b01e953d5ce10ce6c3200f8e7b 100644 (file)
@@ -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') {