Project

General

Profile

Actions

Support #8200

open

Question: WText inline image without UnsafeXHTML ?

Added by Andrii Zhuk over 3 years ago. Updated over 3 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
03/12/2021
Due date:
% Done:

0%

Estimated time:

Description

Hi All,

I am trying to insert into WText widget inlined image, like

<span style="display:inline-block;">
<img>
</img>
</span>

but it happens to work only with UnsafeXHTML

As long as data provided for the widget comes from various sources, i do want benefit from safe variant, avoiding dangerous scripts running.

Is there a way to make it in an alternative safe manner, staying simple at the same time (not writing own parser to insert layout widgets etc) ?
Or is there a chance img directive will be moved to safe side, just like span, and parsed dirrectly from the text ?

Actions #1

Updated by Korneel Dumon over 3 years ago

Hi Andrii,

I think you need WTemplate, there you can put images in the text. Then you can use WTemplate::bindString to bind any text that should be filtered.
Another way to add an image to a page is to use WImage.

Actions #2

Updated by Andrii Zhuk over 3 years ago

Korneel Dumon wrote in #note-1:

Hi Andrii,

I think you need WTemplate, there you can put images in the text. Then you can use WTemplate::bindString to bind any text that should be filtered.
Another way to add an image to a page is to use WImage.

Thank you Korneel, WTemplate + WTemplate::bindWidget (using WImageas widget) did the trick.

Was a little bit stuck on thw way how template is created and operates. So for someone else:

Actions

Also available in: Atom PDF