You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by jim basilakis <ji...@ee.unsw.edu.au> on 2003/11/29 06:05:04 UTC
re: SourceWritingTransformer to save jpeg/png to filesystem
Hi,
Does anyone know how to save a png/jpg generated by .svg file onto the
file system. I have been hinted before to use SourceWritingTransformer
but does this apply to images as well as simple files?
If so, what would I need to do?
Would something like this work...
<map:transform type="write-source">
<map:parameter name="serializer" value="svg2png"/>
</map:transform>
Thanks in advance,
Jim
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
RE: SourceWritingTransformer to save jpeg/png to filesystem
Posted by jim basilakis <ji...@ee.unsw.edu.au>.
Thanks for your reply.
I have tried replacing the serializer value from 'xml' to 'svg2png' and it
gave an error saying it not able to do this. I will try and look at the
source code and see what I can do save an image on the filesystem. If I get
the answer I will let you know.
Thanks again,
Jim
-----Original Message-----
From: Upayavira [mailto:uv@upaya.co.uk]
Sent: Saturday, 29 November 2003 6:46 PM
To: users@cocoon.apache.org
Subject: Re: SourceWritingTransformer to save jpeg/png to filesystem
jim basilakis wrote:
>Hi,
>
>Does anyone know how to save a png/jpg generated by .svg file onto the
>file system. I have been hinted before to use SourceWritingTransformer
>but does this apply to images as well as simple files?
>
>If so, what would I need to do?
>
>Would something like this work...
>
>
><map:transform type="write-source">
> <map:parameter name="serializer" value="svg2png"/>
></map:transform>
>
>
You can certainly set the serializer. The javadocs say:
Definition:
<map:transformer name="tofile"
src="org.apache.cocoon.transformation.SourceWritingTransformer">
<!-- 'xml' is the default Serializer (if your Source needs one, like for
instance FileSource) -->
<map:parameter name="serializer" value="xml"/>
</map:transformer/>
Invocation:
<map:transform type="tofile">
<map:parameter name="serializer" value="xml"/> <!-- you can optionally
override the serializer here -->
</map:transform>
And you replace the xml with svg2png.
[Never tried it though...]
Regards, Upayavira
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: SourceWritingTransformer to save jpeg/png to filesystem
Posted by Upayavira <uv...@upaya.co.uk>.
jim basilakis wrote:
>Hi,
>
>Does anyone know how to save a png/jpg generated by .svg file onto the
>file system. I have been hinted before to use SourceWritingTransformer
>but does this apply to images as well as simple files?
>
>If so, what would I need to do?
>
>Would something like this work...
>
>
><map:transform type="write-source">
> <map:parameter name="serializer" value="svg2png"/>
></map:transform>
>
>
You can certainly set the serializer. The javadocs say:
Definition:
<map:transformer name="tofile" src="org.apache.cocoon.transformation.SourceWritingTransformer">
<!-- 'xml' is the default Serializer (if your Source needs one, like for instance FileSource) -->
<map:parameter name="serializer" value="xml"/>
</map:transformer/>
Invocation:
<map:transform type="tofile">
<map:parameter name="serializer" value="xml"/> <!-- you can optionally override the serializer here -->
</map:transform>
And you replace the xml with svg2png.
[Never tried it though...]
Regards, Upayavira
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org
Re: SourceWritingTransformer to save jpeg/png to filesystem
Posted by Sebastian Klamar <se...@tux.wh17.tu-dresden.de>.
* jim basilakis [2003-11-29 06:05 +0100] wrote:
> Does anyone know how to save a png/jpg generated by .svg file onto the
> file system. I have been hinted before to use SourceWritingTransformer
Another hint from me: If it's not important to write the images to
file system you can also use the pair FragmentExtractorTransformer and
FragmentExtractorGenerator (batik block). The former extracts embedded
SVG code from the source file (maybe XHTML that embedds several SVG
images) and writes it to a (transient) store. Every embedded SVG code
gets replaced by a link which you can use[1] to call another pipeline
(the FEGenerator retrieves it from store) generating the pngs/jpgs.
Sebastian
[1] Usually you XSL transform the links looking like <fe:fragment
fragment-id="208d3449fe3684ba"/> to something the browser recognizes
as images (e.g. <img src="gen-images/208d3449fe3684ba.jpg"/>)
--
Dinge, die man nicht hören will, wenn man operiert wird:
»Hoppla, ich habe gerade meine Rolex verloren.«
************************************************************************
PGP Key: 0x1E727CE6 / 9085 48BD 8332 4BFC D80C A6CF D162 20BB 1E72 7CE6