If overlay text contains html entities (for example: "Title") after case formatting to upper case it will be "TITLE" as result on the image it will be "TITLE" instead of "TITLE"

Comments

xopoc created an issue. See original summary.

andrei_khalipau’s picture

Status: Active » Needs review
StatusFileSize
new1.03 KB
slashrsm’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Let's update the test too.

mondrake’s picture

For understanding, can you please explain how you are getting to have HTML entities at this point of effect execution? Via tokens, programmatically, etc?

IMHO I think here we should be dealing with text only, with any HTML decoding/stripping done already in code upstream. If (edge case, I know) you want to actually have " overlaid on the text, then with this you would get it converted to " anyway.

For example, in Textimage, the content of a text field is passed through strip_tags before being sent to the image effect (see #2150599: Filter field text before using it to render a Textimage), so when the effect code is executed this actually manages a filtered and 'clean' text already.

andrei_khalipau’s picture

Status: Needs work » Needs review
StatusFileSize
new1.01 KB

I get text for overlay via tokens.

$this->configuration['text_string'] = $this->token->replace($this->configuration['text_string'], ['image' => $this->image]);

The method above returns text with encoded html entities.
You are right we do not need to convert symbols to entities back.
A patch is updated.

To slashrsm: Could you explain what is needed to update in the test? The current ImageEffectsTextOverlayTest passes.

mondrake’s picture

Title: Case formatting does not work properly with Html entities in TextOverlayImageEffect » [PP-1] Text overlay: Case formatting does not work properly with Html entities
Category: Bug report » Feature request
Status: Needs review » Postponed
Parent issue: » #2702205: Text overlay: add an hook to alter the overlaid text and use it to enable setting maximum number of characters displayed

Let's do #2702205: Text overlay: add an hook to alter the overlaid text and use it to enable setting maximum number of characters displayed first, then use the hook mechanism introduced there to do this, adding an option to the effect so that users can decide if to do the decoding or not.

mondrake’s picture

Title: [PP-1] Text overlay: Case formatting does not work properly with Html entities » Text overlay: introduce options to decode HTML entities and strip HTML tags from the overlaid text
Status: Postponed » Active
mondrake’s picture

Status: Active » Needs review
Issue tags: -Needs tests
StatusFileSize
new8.83 KB

Patch. Introduces UI options in the Text Overlay effect config form for:

  • removing HTML tags
  • decoding HTML entities

+ update functions + tests.

mondrake’s picture

StatusFileSize
new1.06 KB
new8.84 KB

Force conversion to bool when getting the config value from the form.

mondrake’s picture

StatusFileSize
new1.67 KB
new9.59 KB

Testing manually, there are schema issues when previewing the effect results.

mondrake’s picture

StatusFileSize
new773 bytes
new10.1 KB

Removed a PHP notice while previewing.

  • mondrake committed db666d7 on 8.x-1.x
    Issue #2729519 by mondrake, xopoc: Text overlay: introduce options to...
mondrake’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.