I read the filters documentation and I typed the following code for example:
[% FILTER null;
data = [ ["1st","2nd","3rd","4th","5th","6th"],
[ 4, 2, 3, 4, 3, 3.5] ];
USE my_graph = GD.Graph.pie( 250, 200 );
my_graph.set(
title => 'A Pie Chart',
label => 'Label',
axislabelclr => 'black',
pie_height => 36,
transparent => 0,
);
my_graph.plot(data).png | redirect("/home/savio.png", binmode=1);
END; -%]
taken from:
http://perl.asylog.net/perl5.6.1/site_perl/5.6.1/sun4-solaris/Template/Plugin/GD/Graph/pie.html
I changed stdout(1) with redirect("/home/savio.png", binmode=1);
but I have the following error:
Software error:
redirect error - OUTPUT_PATH is not set
--- Sab 10/4/10, Stuart Johnston <[email protected]> ha scritto:
> Da: Stuart Johnston <[email protected]>
> Oggetto: Re: [Templates] Template::Plugin::GD usage
> A: [email protected]
> Data: Sabato 10 Aprile 2010, 01:21
> In order to use the redirect filter
> you need to set the OUTPUT_PATH
> config param to specify the directory into which files may
> be written.
>
> http://tt2.org/docs/manual/Filters.html#section_redirect_file_options_
>
>
> dark0s wrote:
> > I have the following error:
> >
> > Software error:
> >
> > redirect error - OUTPUT_PATH is not set
> >
> > What is the problem?
> >
> > savio
> >
> > --- Sab 10/4/10, Stuart Johnston <[email protected]>
> ha scritto:
> >
> >> Da: Stuart Johnston <[email protected]>
> >> Oggetto: Re: [Templates] Template::Plugin::GD
> usage
> >> A: [email protected]
> >> Data: Sabato 10 Aprile 2010, 00:23
> >> There are a few different was to do
> >> this but probably the easiest is to
> >> save the image to disk. Something like:
> >>
> >> [% FILTER null;
> >> USE im =
> >> GD.Image(50,50);
> >> # allocate some
> >> colors
> >> black =
> >> im.colorAllocate(0, 0, 0);
> >>
> >> red =
> >> im.colorAllocate(255,0, 0);
> >> blue =
> >> im.colorAllocate(0, 0, 255);
> >> # Draw a blue
> oval
> >>
> >> im.arc(50,50,95,75,0,360,blue);
> >> # And fill it
> with
> >> red
> >>
> im.fill(50,50,red);
> >> # Output binary
> >> image in PNG format
> >> im.png |
> >> redirect('/path/to/image.png');
> >> END;
> >> -%]
> >>
> >> <img
> >> src="/url/to/image.png">
> >>
> >> If the images are reusable, you could put in some
> logic to
> >> check if the
> >> file exists already before regenerating.
> >>
> >>
> >>
> >> dark0s wrote:
> >>> Ok, I excuse me because I'm not expert with
> template
> >> toolkit.
> >>> Where is the source of the following block
> code?
> >>>
> >>> [% FILTER null;
> >>> USE im =
> >> GD.Image(50,50);
> >>> # allocate
> some
> >> colors
> >>> black =
> >> im.colorAllocate(0, 0, 0);
> >>>
> >> red =
> >> im.colorAllocate(255,0, 0);
> >>> blue
> =
> >> im.colorAllocate(0, 0, 255);
> >>> # Draw a
> blue
> >> oval
> >>>
> >> im.arc(50,50,95,75,0,360,blue);
> >>> # And fill
> it
> >> with red
> >>>
> >> im.fill(50,50,red);
> >>> # Output
> binary
> >> image in PNG format
> >>> im.png |
> >> stdout(1);
> >>> END;
> >>> -%]
> >>>
> >>>
> >>>
> >>>
> >>>
> >>> --- Ven 9/4/10, Randy J. Ray <[email protected]>
> >> ha scritto:
> >>>> Da: Randy J. Ray <[email protected]>
> >>>> Oggetto: Re: [Templates]
> Template::Plugin::GD
> >> usage
> >>>> A: "dark0s" <[email protected]>
> >>>> Cc: [email protected]
> >>>> Data: Venerdì 9 Aprile 2010, 21:50
> >>>> dark0s wrote:
> >>>>> With stdout(1) system outputs a lot of
> symbols
> >> without
> >>>> sense.
> >>>>
> >>>> That's because you're trying to emit the
> image
> >> directly
> >>>> within the table cell. HTML doesn't work
> like
> >> that. You have
> >>>> to reference images with the "<img>"
> tag and
> >> a URL
> >>>> that (when fetched) returns the image
> data.
> >>>>
> >>>> Randy
> >>>> --
> >>>>
> >>
> """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
> >>>> Randy J. Ray
> Sunnyvale,
> >> CA
> >>>> http://www.rjray.org [email protected]
> >>>>
> >>>> Silicon Valley Scale Modelers: http://www.svsm.org
> >>>>
> >>>
> >>>
> >>>
> >>>
> _______________________________________________
> >>> templates mailing list
> >>> [email protected]
> >>> http://mail.template-toolkit.org/mailman/listinfo/templates
> >>
> >> _______________________________________________
> >> templates mailing list
> >> [email protected]
> >> http://mail.template-toolkit.org/mailman/listinfo/templates
> >>
> >
> >
> >
>
>
> _______________________________________________
> templates mailing list
> [email protected]
> http://mail.template-toolkit.org/mailman/listinfo/templates
>
_______________________________________________
templates mailing list
[email protected]
http://mail.template-toolkit.org/mailman/listinfo/templates