You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Borges Charles <ch...@yahoo.fr> on 2003/11/19 19:27:33 UTC

SVGSerializer patch

Hi,

Here's proposed SVGSerializer patch to support request
parameters.

The following changes have been made:

Configuration
=============
1. 
The <use-request-parametes> tag is recognized to allow
the serializer to use request parameters.
if true ==> All the declared batik keys can be
overriden by request parameters.

3. 
The value attribute of the key now means it's a
default value and is not mandatory anymore.

4.
A default TranscodingHints is configured with all the
keys entries which have a default value

5.
A Map is used to keep information on batik transcoding
keys and their "types" (INTEGER, ...)

Processing
==========

1.
The SVGSerializer implements the SitemapModelComponent

2.
A current TranscodingHints is built overriding the
default one and adding new key values if their "types"
can be resolved.

EXEMPLE
=======

1.
in the batik block sitemap add this instead of the
current the svg2png serializer:

<map:serializer logger="sitemap.serializer.svg2png"
name="svg2png"
src="org.apache.cocoon.serialization.SVGSerializer"
mime-type="image/png">
 <use-request-parameters>true</use-request-parameters>
 <parameter name="indexed" type="integer" value="16"/>
 <parameter name="height" type="float"/>
 <parameter name="width" type="float"/>
</map:serializer>

2.
Try this:
samples/batik/batikLogo.png
... the normal logo
or
samples/batik/batikLogo.png?width=200&height=100
... small logo
or
samples/batik/batikLogo.png?width=200&height=100&indexed=2
... ugly!










=====
BORGES C.

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com

Re: SVGSerializer patch

Posted by Torsten Curdt <tc...@vafer.org>.
Borges Charles wrote:

> Hi,
> 
> Here's proposed SVGSerializer patch to support request
> parameters.

Thanks, but please file it into bugzilla
--
Torsten



Re: SVGSerializer patch

Posted by Vadim Gritsenko <va...@verizon.net>.
Tony Collen wrote:

> Vadim Gritsenko wrote:
>
>> Borges Charles wrote:
>>
>>> Hi,
>>>
>>> Here's proposed SVGSerializer patch to support request
>>> parameters.
>>>  
>>>
>> ...
>>
>>> or
>>> samples/batik/batikLogo.png?width=200&height=100&indexed=2
>>> ... ugly!
>>>  
>>>
>>
>> Or
>> samples/batik/batikLogo.png?width=1000&height=1000
>> samples/batik/batikLogo.png?width=1000&height=1001
>> samples/batik/batikLogo.png?width=1000&height=1002
>> ...
>> in the loop and your server is down.
>>
>> No, thank you, I'll pass on this particular parameter!
>
>
> Shouldn't this be a concern of a transformer or the generator, anyway, 
> and not the serializer??
>
> Just pass the request parameters to an XSLT to change the svg height 
> or width, then output the image.


Even better: pass via sitemap parameter (I like this way more :)

Vadim



Re: SVGSerializer patch

Posted by Joerg Heinicke <jo...@gmx.de>.
On 24.11.2003 11:25, Borges Charles wrote:

>>>I think that in cocoon 2.1.3 the sitemap parameters
>>
>>are not available for serializers. They're always
>>set to empty parameters when the
>>SitemapModelComponent is a Serializer.
>>
>>>Is that correct?
>>> 
>>>
>>
>>It is correct that... you found a bug :-/
>>
>>The sitemap engine wasn't updated to take into
>>account the ability for 
>>serializers to implement SitemapModelComponent.
>>
>>I just fixed it in the CVS.
>>
>>Sylvain
>>
> 
> 
> Given this bug fix, i propose a SVGSerializer patch
> which support sitemap parameters (see attached files).

Your help is much appreciated. Please add the bug to bugzilla, so it 
won't get lost.

Thanks.

Joerg


Re: SVGSerializer patch

Posted by Borges Charles <ch...@yahoo.fr>.
> >I think that in cocoon 2.1.3 the sitemap parameters
> are not available for serializers. They're always
> set to empty parameters when the
> SitemapModelComponent is a Serializer.
> >Is that correct?
> >  
> >
> 
> It is correct that... you found a bug :-/
> 
> The sitemap engine wasn't updated to take into
> account the ability for 
> serializers to implement SitemapModelComponent.
> 
> I just fixed it in the CVS.
> 
> Sylvain
> 

Given this bug fix, i propose a SVGSerializer patch
which support sitemap parameters (see attached files).

Thus,

1. in the serializer configuration you define the
transcoding hints which can be overriden by the
sitemap parameters, say:
<map:serializer logger="sitemap.serializer.svg2png"
name="svg2png"
src="org.apache.cocoon.serialization.SVGSerializer"
mime-type="image/png">
 <parameter name="indexed" type="integer" value="16"/>
</map:serializer>

2. Override in a serialize node:
<map:serialize type="svg2png">
 <map:parameter name="override-transcoding-hints"
value="true"/>
 <map:parameter name="indexed" value="2"/>
</map:serialize>

Charles

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com

Re: SVGSerializer patch

Posted by Sylvain Wallez <sy...@apache.org>.
Borges Charles wrote:

> --- Vadim Gritsenko <va...@verizon.net> a
>écrit : > Borges Charles wrote:
>  
>
>>>Do you have an idea of how to do if you want to override parameters used to render an image like the indexed or quality parameters?
>>>      
>>>
>>Pass via sitemap parameters; passing it via request parameters does not look like a safe approach to me.
>>
>>Vadim
>>
>>    
>>
>
>I think that in cocoon 2.1.3 the sitemap parameters are not available for serializers. They're always set to empty parameters when the SitemapModelComponent is a Serializer.
>Is that correct?
>  
>

It is correct that... you found a bug :-/

The sitemap engine wasn't updated to take into account the ability for 
serializers to implement SitemapModelComponent.

I just fixed it in the CVS.

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com



Re: SVGSerializer patch

Posted by Borges Charles <ch...@yahoo.fr>.

 --- Vadim Gritsenko <va...@verizon.net> a
écrit : > Borges Charles wrote:
> 
> >Do you have an idea of how to do if you want to
> >override parameters used to render an image like
> the
> >indexed or quality parameters?
> >  
> >
> 
> Pass via sitemap parameters; passing it via request
> parameters does not 
> look like a safe approach to me.
> 
> Vadim
> 

I think that in cocoon 2.1.3 the sitemap parameters
are not available for serializers. They're always set
to empty parameters when the SitemapModelComponent is
a Serializer.
Is that correct?

Thanks.


___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com

Re: SVGSerializer patch

Posted by Vadim Gritsenko <va...@verizon.net>.
Borges Charles wrote:

>Do you have an idea of how to do if you want to
>override parameters used to render an image like the
>indexed or quality parameters?
>  
>

Pass via sitemap parameters; passing it via request parameters does not 
look like a safe approach to me.

Vadim



Re: SVGSerializer patch

Posted by Borges Charles <ch...@yahoo.fr>.
 --- Tony Collen <co...@umn.edu> a écrit : > Vadim
Gritsenko wrote:
> > Borges Charles wrote:
> > 
> >> Hi,
> >>
> >> Here's proposed SVGSerializer patch to support
> request
> >> parameters.
> >>  
> >>
> > ...
> > 
> >> or
> >>
>
samples/batik/batikLogo.png?width=200&height=100&indexed=2
> >> ... ugly!
> >>  
> >>
> > 
> > Or
> > samples/batik/batikLogo.png?width=1000&height=1000
> > samples/batik/batikLogo.png?width=1000&height=1001
> > samples/batik/batikLogo.png?width=1000&height=1002
> > ...
> > in the loop and your server is down.
> > 
> > No, thank you, I'll pass on this particular
> parameter!
> 
> Shouldn't this be a concern of a transformer or the
> generator, anyway, and not the serializer??
> 
> Just pass the request parameters to an XSLT to
> change the svg height or width, then output the
> image.
> 
> Tony
>  

I think this example with height and width wasn't a
good choice.
I agree with you, when it comes to change such
parameters which are specified in the svg (height,
width, background color...) it's wiser to go for an
XSLT.

Do you have an idea of how to do if you want to
override parameters used to render an image like the
indexed or quality parameters?

Thanks

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com

Re: SVGSerializer patch

Posted by Tony Collen <co...@umn.edu>.
Vadim Gritsenko wrote:
> Borges Charles wrote:
> 
>> Hi,
>>
>> Here's proposed SVGSerializer patch to support request
>> parameters.
>>  
>>
> ...
> 
>> or
>> samples/batik/batikLogo.png?width=200&height=100&indexed=2
>> ... ugly!
>>  
>>
> 
> Or
> samples/batik/batikLogo.png?width=1000&height=1000
> samples/batik/batikLogo.png?width=1000&height=1001
> samples/batik/batikLogo.png?width=1000&height=1002
> ...
> in the loop and your server is down.
> 
> No, thank you, I'll pass on this particular parameter!

Shouldn't this be a concern of a transformer or the generator, anyway, and not the serializer??

Just pass the request parameters to an XSLT to change the svg height or width, then output the image.

Tony


Re: SVGSerializer patch

Posted by Vadim Gritsenko <va...@verizon.net>.
Borges Charles wrote:

>Hi,
>
>Here's proposed SVGSerializer patch to support request
>parameters.
>  
>
...

>or
>samples/batik/batikLogo.png?width=200&height=100&indexed=2
>... ugly!
>  
>

Or
samples/batik/batikLogo.png?width=1000&height=1000
samples/batik/batikLogo.png?width=1000&height=1001
samples/batik/batikLogo.png?width=1000&height=1002
...
in the loop and your server is down.

No, thank you, I'll pass on this particular parameter!

Vadim