From 6cc43773e728df783e29389680e6bf50d3ef6592 Mon Sep 17 00:00:00 2001 From: chrysn Date: Mon, 7 Apr 2014 11:19:04 +0200 Subject: [PATCH] add pdf support to the img directive this is trivial as pdf is supported by imagemagick, and just needs an explicit mention to enable conversion. --- IkiWiki/Plugin/img.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/IkiWiki/Plugin/img.pm b/IkiWiki/Plugin/img.pm index c861d7075..ae681f9e6 100644 --- a/IkiWiki/Plugin/img.pm +++ b/IkiWiki/Plugin/img.pm @@ -65,6 +65,7 @@ sub preprocess (@) { my $dir = $params{page}; my $base = IkiWiki::basename($file); my $issvg = $base=~s/\.svg$/.png/i; + my $ispdf = $base=~s/\.pdf$/.png/i; eval q{use Image::Magick}; error gettext("Image::Magick is not installed") if $@; @@ -124,7 +125,7 @@ sub preprocess (@) { # don't actually write resized file in preview mode; # rely on width and height settings if (! $params{preview}) { - $im->set($issvg ? (magick => 'png') : ()); + $im->set(($issvg || $ispdf) ? (magick => 'png') : ()); my @blob = $im->ImageToBlob(); writefile($imglink, $config{destdir}, $blob[0], 1); } -- 2.44.0