Skip to content
This repository has been archived by the owner on May 25, 2019. It is now read-only.

Path variable inside n:src macro #7

Open
jaygridley opened this issue Dec 17, 2017 · 5 comments
Open

Path variable inside n:src macro #7

jaygridley opened this issue Dec 17, 2017 · 5 comments

Comments

@jaygridley
Copy link

Hi, is there any chance how to pass variable with image path into src macro? I am trying to pass <img n:src="presenter:images://$path, 200x200, fill" /> but $path variable is not evaluated to variable's value and string '$path' is used instead. Thanks for advice.

@TheSoundOfTNT
Copy link

I have the same issue, do you have any solution?
Thank you

@akadlec
Copy link
Contributor

akadlec commented Mar 15, 2018

so why you not define path before this macro? Something like:

{var imageDefinition = 'presenter:images://' . $path .', 200x200, fill'}
<img n:src="$imageDefinition" />

@TheSoundOfTNT
Copy link

TheSoundOfTNT commented Mar 15, 2018

Becouse it doesn't work. Maybe I'm doing something wrong.
I tried to do everything, but without result.
It seems that macro get the variable only as string name, and it can't parse provider, storage, filename etc.

@jaygridley
Copy link
Author

As I mentioned before, any variable won't be evaluated. Same for the $imageDefinition you've suggested.

@akadlec
Copy link
Contributor

akadlec commented Mar 15, 2018

So in this case use template helper: https://github.com/iPublikuj/images/blob/master/src/IPub/Images/Templating/Helpers.php#L102
macro is taking attribute as string.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants