plugin => {
safe => 1,
rebuild => undef,
+ section => "widget",
},
}
# Use the sha1 of the php code that generates the sparkline as
# the base for its filename.
- eval q{use Digest::SHA1};
+ eval q{use Digest::SHA};
error($@) if $@;
my $fn=$params{page}."/sparkline-".
- IkiWiki::possibly_foolish_untaint(Digest::SHA1::sha1_hex($php)).
+ IkiWiki::possibly_foolish_untaint(Digest::SHA::sha1_hex($php)).
".png";
will_render($params{page}, $fn);
waitpid $pid, 0;
$SIG{PIPE}="DEFAULT";
- if ($sigpipe) {
+ if ($sigpipe || ! defined $png) {
error gettext("failed to run php");
}
writefile($fn, $config{destdir}, $png, 1);
}
else {
- # can't write the file, so embed it in a data uri
+ # in preview mode, embed the image in a data uri
+ # to avoid temp file clutter
eval q{use MIME::Base64};
error($@) if $@;
return "<img src=\"data:image/png;base64,".