cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Mieth <simon.mi...@t-online.de>
Subject Re: Referencing inline images - How to?
Date Mon, 16 Feb 2004 09:36:50 GMT
On Mon, 16 Feb 2004 07:46:26 +0000
beyaNet Consultancy <beyanet@ntlworld.com> wrote:

> Hi,
> so far I have been making reference to images via my
> sitemap as   standard:
> 
> 			<map:match pattern="*.jpg">
> 				<map:read mine-type="text/jpeg"
> 				src="images/{1}.jpg" />
> 			</map:match>
> 
> As I am now using inline images I have changed my sitemap
> to the  following:
> 
> 			<map:match pattern="artist1">
> 				<map:read mine-type="image/jpeg"
> 				src="artist1" />
> 			</map:match>
> 
> My image structure is:
> 
> 			<xsp:element name="object">
> 				<xsp:attribute
> 				name="id">artist1</xsp:attribute><xsp:attr
> 				ibute
> 				name="width">200</xsp:attribute><xsp:attri
> 				bute
> 				name="height">200</xsp:attribute><xsp:attr
> 				ibute
> 				name="type">image/jpeg</xsp:attribute><xsp
> 				:attribute  
> name="data">data:image/jpeg;base64,<xsp:expr>base64-strin
> g</xsp:expr></ xsp:attribute>
> 			</xsp:element>
> 
> When viewed in the browser the image is broken, i.e. it
> cannot find it.  How do i resolve this? Do I reference
> back to the xsl page the image  sits in?
> 
> The sitemap structure for the page the image sits in is:
> 
> 			<map:generate type="serverpages"
> 			src="xsp/{../1}.xsp" /><map:transform
> 			type="xslt" src="style/frame-page.xsl"
> 			/><map:serialize type="html"/>
> 
> many thanks in advance

Hi,

the map:read can only read images direct. If you want to get
your images from your db, then you have to create an own
reader (java-component, no xsp) that query your db and write
the image to the reponse-stream direct.

But i see you have the images base64 endcoded, isnt it?
You can now simple create a pipeline like this.

<map:match pattern="*.jpg">
   <map:generate type="serverpages" src="my.xsp" /> 
<!-- your xsp, that get the images from db and make a
svg here-->   
   <map:serialize type="svg2jpeg"/>
</map:match>

Your XSP should give a SVG-XML-document like:

<svg width="...." height="......">
<image xmlns:xlink="http://www.w3.org/1999/xlink
xlink:href="data:image/png;base64,!!!your base64 string
here !!!"/>
</svg>


Best Regards,

Simon










---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Mime
View raw message