Macro does not display anything when used in src attribute for image
Notice: This thread is very old.
- josef.sabl
- Member | 153
We have a latte macro like this:
public function ___binToImage($image)
{
return "data:{$image->type};base64,{$image->data}";
}
And use it in template like this:
<img src="{$product->image|binToImage}">
And it does not work.
Although this is expected
<img src="data:...;base64,...">
Generated html looks like this
<img src="">
If I do anything from this:
- change the attribute to something else (src2)
- display the macro out of the attribute (<p>{$product->image|binToImage}</p>)
- change the contents of the string returned from macro (return “foobar”)
it works as expected. There has to be some escaping involved but using noescape did not help.