wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Dudgeon <tdudgeon...@gmail.com>
Subject Re: Handling SVG images
Date Sat, 03 Sep 2016 18:33:05 GMT
Thank you. That did the trick.


On 02/09/2016 16:34, Martin Grigorov wrote:
> Hi,
>
> I think you need to set the Content-Type.
> Override #configureResponse() of the resource.
>
> On Sep 2, 2016 4:22 PM, "Tim Dudgeon" <tdudgeon.ml@gmail.com> wrote:
>
>> I'm wanting to handle SVG as an image using DynamicImageResource. The
>> images comes from an external source. I've got it working fine using PNG
>> images but it seems the approach doesn't work for SVG, maybe because its
>> not a binary format?
>> This is (sort of) how it looks:
>>
>> Markup:
>>
>> <img wicket:id="svgImage"/>
>>
>> Java:
>>
>> add(new MyImage("svgImage");
>>
>> class MyImage extends Image {
>>
>> MyImage(String id) {
>>          super(id);
>>          setImageResource(new DynamicImageResource("svg") {
>>
>>              @Override
>>              protected byte[] getImageData(Attributes attributes) {
>>                  // fetch the SVG and return it's String.getBytes()
>>              }
>>          }
>>      }
>> }
>>
>>
>> Any thoughts on how this should be done?
>>
>> Thanks
>> Tim
>>


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


Mime
View raw message