Estou tentando exibir imagem png com o embperl, mas não estou tendo sucesso. Simplesmente não aparece nada! Eu estou gerando uma imagem ps com o R, depois converto essa imagem para png. Até ai funciona certinho, mas quando vai para a parte de exibir a imagem, não aparece nada!! Alguém poderia me ajudar, por favor?
Ai vai o meu código!
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html";>
<title>teste 18102007</title>
</head>
<body>
[+
use strict;
use lib '/usr/lib/R/bin/exec';
use lib '/home/Statistics-R-0.02/lib';
use Statistics::R;
# plot something
my $R = Statistics::R->new() ;
$R->startR;
$R->send(qq (xVal <- c(1,2,3,4,5,6)));
$R->send(qq (yVal <- c(3,5,2,6,1,5)));
my $path = "/home/rulee/interface/images/perlPlotTest.ps";
$R->send(qq(c(postscript("$path",horizontal=FALSE , width=500 , height=500 , pointsize=1), plot(xVal,yVal), dev.off())));
my $ret = $R->read;
exec "convert /home/rulee/interface/images/perlPlotTest.ps /home/rulee/interface/images/perlPlotTest.png";
my $graphicname = "../images/perlPlotTest.png";
+]
<p><img src="[+ $graphicname; +]" alt="test"></p>
</body>
</html>
#--------------------------------------------------------------------------------------
Tentando exibir de outra forma, ele interpreta as tags como texto...
O código que eu fiz:
<html>
<head>
<title>teste</title>
</head>
<body>
[+
my $html="";
$html = $html."\<img src=\"../images/perlPlotTest.png\">";
$html;
+]
</body>
</html>
Aparece como:
<html>
<head>
<title>teste</title>
</head>
<body>
<img src="../images/perlPlotTest.png">
</body>
</html>
Editado por mli, 22 October 2007 - 01:38 PM.











