4

I'm having trouble getting the full URL to an image using Low Variables and Assets.

Using the short name of the variable just returns the file name without the rest of the path. {lv_my_image} renders as image.jpg not http://site.com/images/image.jpg.

I've tried several ways to do this.

{lv_my_image} = image.jpg
{lv_my_image:url} = {lv_my_image:url}

{exp:low_variables:pair var="lv_my_image"}
  {url} = *nothing is returned*
  {assets:url} = {assets:url}
{/exp:low_variables:pair}
11

Turns out my problem was the {exp:low_variables:pair} tag was nested in a {exp:channel:entries} tag. To fix this you have to use the var_prefix="" parameter.

{exp:low_variables:pair var="lv_my_image" var_prefix="assets"}
  {assets:url}
{/exp:low_variables:pair}

With this syntax you can access all of the Assets' tags.

{exp:low_variables:pair var="lv_my_image" var_prefix="assets"}
  <img src="{assets:url}" width="{assets:width}" height="{assets:height}" alt="{assets:alt_text}">
{/exp:low_variables:pair}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.