Hi, I have still some issues using this svg rasterizing API.

I'm trying to use rasterizeToTemporaryResource to use the returned url in
the img element in html macro, see my example bellow. But I cannot get this
to return working url. It returns in my xwiki instace
"/test-xwiki/wiki/xwiki/temp/Page1/WebHome/svg/858799895.png". I compared
it to old svg plugin using $xwiki.svg.getSVGImageURL, and that works and
returns the following working url:
"/test-xwiki/bin/svg/Test/Page1/WebHome/858799895.png". What's wrong?

{{velocity}}

#set($svgText = "<svg width=""640"" height=""480"" xmlns:xlink=""
http://www.w3.org/1999/xlink""; xmlns=""http://www.w3.org/2000/svg"";>
 <g>
  <title>Layer 2</title>
  <rect transform=""rotate(29.0349, 399.602, 239.6)"" stroke-width=""5""
stroke=""#000000"" fill=""#0000ff"" id=""svg_1"" height=""213.948426""
width=""324.49861"" y=""132.625181"" x=""237.349801""/>
  <text x=""374.6"" y=""242.1"" id=""svg_2"" fill=""#000000""
stroke=""#000000"" stroke-width=""0"" font-size=""24""
font-family=""serif"" text-anchor=""middle"" xml:space=""preserve""
transform=""matrix(1, 0, 0, 1, 27, 10)"">This is an SVG Drawing</text>
 </g>
</svg>")
#set($svgUrl = $services.svg.rasterizeToTemporaryResource($svgText, 640,
480))
$svgUrl

{{html}}
<img src="$svgUrl" width="480" height="480" alt="The image from
services.svg.rasterizeToTemporaryResource" />
<img src="$xwiki.svg.getSVGImageURL($svgText, 640, 480)" width="480"
height="480" alt="The image from xwiki.svg.getSvgImageUrl" />
{{/html}}

{{/velocity}}


On 19 May 2016 at 10:48, Vincent Massol <vinc...@massol.net> wrote:

>
> > On 19 May 2016, at 10:45, Miroslav Galajda <miroslav.gala...@gmail.com>
> wrote:
> >
> > By the way the "announcement" was in the release notes here
> >
> http://www.xwiki.org/xwiki/bin/view/ReleaseNotes/ReleaseNotesXWiki80#HNewSVGRasterizingAPI
>
> Thanks, I’ve updated the text a bit:
>
> http://www.xwiki.org/xwiki/bin/view/ReleaseNotes/ReleaseNotesXWiki80#HNewSVGRasterizingAPI
>
> -Vincent
>
> > On 19 May 2016 at 10:44, Miroslav Galajda <miroslav.gala...@gmail.com>
> > wrote:
> >
> >> Hi, great. Thank you. Now I can see it in the extesion manager.
> >>
> >> Best regards
> >> Miroslav Galajda
> >>
> >> On 19 May 2016 at 10:34, Marius Dumitru Florea <
> >> mariusdumitru.flo...@xwiki.com> wrote:
> >>
> >>> On Thu, May 19, 2016 at 11:32 AM, Vincent Massol <vinc...@massol.net>
> >>> wrote:
> >>>
> >>>
> >>>> Note: just saw Marius’ message so I guess whoever contributed this
> >>>> extension had forgotten to document that it can be installed with the
> >>>> Extension Manager… :)
> >>>>
> >>>
> >>> The extension page had the wrong extension id (xwiki-platform-svg
> instead
> >>> of xwiki-platform-svg-rasterizer) and thus it wasn't listed in the
> >>> Extension Manager. I reimported the extension and now it's fine.
> >>>
> >>>
> >>>>
> >>>> Thanks Marius for fixing it
> >>>> -Vincent
> >>>>
> >>>>> On 19 May 2016, at 10:31, Vincent Massol <vinc...@massol.net> wrote:
> >>>>>
> >>>>> Hi Miroslav,
> >>>>>
> >>>>>> On 19 May 2016, at 09:52, Miroslav Galajda <
> >>> miroslav.gala...@gmail.com>
> >>>> wrote:
> >>>>>>
> >>>>>> Hi,
> >>>>>>
> >>>>>> I noticed the anoucement of the new SVG rasterzing API in the XWiki
> >>> 8.0
> >>>>>> version.
> >>>>>
> >>>>> Could you point to where you saw that because I don’t remember any
> >>>> announcement saying that it was bundled with XWiki 8.0?
> >>>>>
> >>>>>> Is it already available, or not? I have tried to use it in the
> >>> velocity
> >>>>>> macro, using the example usage at
> >>>>>>
> >>>>
> >>>
> http://extensions.xwiki.org/xwiki/bin/view/Extension/SVG+Rasterizing+API,
> >>>>>> but it seems that $services.svg is not available. Do I need to
> enable
> >>>> it or
> >>>>>> it is an optional component that I need to install from somewhere.
> >>>>>
> >>>>> You need to install it.
> >>>>>
> >>>>> See
> >>>>
> >>>
> http://extensions.xwiki.org/xwiki/bin/view/Extension/SVG+Rasterizing+API#HPrerequisites26InstallationInstructions
> >>>>>
> >>>>> Thanks
> >>>>> -Vincent
> >>>>>
> >>>>>> Thank you
> >>>>>> Miroslav Galajda
>
> _______________________________________________
> users mailing list
> users@xwiki.org
> http://lists.xwiki.org/mailman/listinfo/users
>
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to