Skip to content

Add optional attribute parameters to images inserted via %file()% command #216

Description

@RealRaven2000

The %file()% command can be used to insert inline images into the email. In order to better control styling and other aspects, allow adding attributes and values as parameters. For example:

%file(img/bargain-upg-bf-de.png,id=bargainStar,width=192)%

This should be converted by SmartTemplates reading the image as bitstream and append the attributes, like this:

<img
src="data:image/png;filename=bargain-upg-bf-de.png;base64,iVBORw0KGgoAAAAN...." id="bargainStar" width="192">

If a string is appended without the "=" then it will be regarded as the optional "alt" argument.

%file(img/bargain-upg-bf-de.png,id=bargainStar,"save 40 per cent")%

becomes this:

<img
src="data:image/png;filename=bargain-upg-bf-de.png;base64,iVBORw0KGgoAAAAN...." id="bargainStar" alt="save 40 per cent">

This makes it easy to add style rules to add more control over layout.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions