X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/14a82190e10651051d394135a4f379bf1134726d..d36361b01015da0338d3c0dc20625b5121ed94b2:/IkiWiki/Plugin/teximg.pm?ds=inline diff --git a/IkiWiki/Plugin/teximg.pm b/IkiWiki/Plugin/teximg.pm index fc890666a..8c3e88c69 100644 --- a/IkiWiki/Plugin/teximg.pm +++ b/IkiWiki/Plugin/teximg.pm @@ -70,25 +70,16 @@ sub create ($$$) { #{{{ my $digest = md5_hex($code, $height); - my $teximgdir = "/teximg"; - my $imglink = "$teximgdir/$digest.png"; - my $imglog = "$teximgdir/$digest.log"; - will_render($params->{destpage}, $imglink); - will_render($params->{destpage}, $imglog); - - my $imgurl; - my $logurl; - if (! $params->{preview}) { - $imgurl = urlto($imglink, $params->{destpage}); - $logurl = urlto($imglog, $params->{destpage}); - } - else { - $imgurl="$config{url}/$teximgdir/$digest.png"; - $logurl="$config{url}/$teximgdir/$digest.log"; - } + my $imglink= $params->{page} . "/$digest.png"; + my $imglog = $params->{page} . "/$digest.log"; + will_render($params->{page}, $imglink); + will_render($params->{page}, $imglog); + + my $imgurl=urlto($imglink, $params->{destpage}); + my $logurl=urlto($imglog, $params->{destpage}); if (-e "$config{destdir}/$imglink" || - gen_image($code, $height, $digest, $teximgdir)) { + gen_image($code, $height, $digest, $params->{page})) { return qq{}
 			.(exists $params->{alt} ? $params->{alt} : encode_entities($code))
 			.qq{}; @@ -128,12 +119,13 @@ sub gen_image ($$$$) { #{{{ } else { # store failure log - my $log; + my $log=""; { - open(my $f, '<', "$tmp/$digest.log"); - local $/=undef; - $log = <$f>; - close($f); + if (open(my $f, '<', "$tmp/$digest.log")) { + local $/=undef; + $log = <$f>; + close($f); + } } writefile("$digest.log", "$config{destdir}/$imagedir", $log);