2

I'm attempting to store several variables generated by CE Image's Pair tag, as follows:

{exp:stash:set parse_tags="yes" parse_depth="2"}
    {exp:ce_img:pair src="{source_image}"}
       {stash:ee_img_original_width'}{width_orig}{/stash:ee_img_original_width}
       {stash:ee_img_sized_src'}{made}{/stash:ee_img_sized_src}
       {stash:ee_img_sized_width'}{width}{/stash:ee_img_sized_width}
    {/exp:ce_img:pair}
{/exp:stash:set}

I've reviewed this post about getting a single var from CE Image, and this one, about grabbing multiple variables from a different tag pair, but I'm not getting anywhere. Thanks in advance!

Corrected Syntax, Per Nate/Mark's Feedback

<h2>Set Vars</h2>
{exp:stash:set parse_tags="yes" parse_depth="2"}
    {exp:ce_img:pair src="{source_image}"}
        {stash:ee_img_original_width}{width_orig}{/stash:ee_img_original_width}
        {stash:ee_img_sized_src}{made}{/stash:ee_img_sized_src}
        {stash:ee_img_sized_width}{width}{/stash:ee_img_sized_width}
    {/exp:ce_img:pair}
{/exp:stash:set}

<h2>Get Vars</h2>
<p>
    Original Width: {exp:stash:get name='ee_img_original_width'}<br>
    Path to New Image: {exp:stash:get name='ee_img_sized_src'}<br>
    New Image Width {exp:stash:get name='ee_img_sized_width'}
</p>
4
  • 1
    Looks like you have an extra single quote on the opening side of the stash vars.
    – Natetronn
    Oct 25, 2013 at 17:24
  • 1
    Yep what Nate said (sorry nate just spotted your comment after answering below). Oct 25, 2013 at 18:10
  • CE Image for me is typically presentation. The only thing I stash is the source image. Then when displaying it, I use CE Image Oct 25, 2013 at 18:42
  • My goodness, it's been one of those days... thank you gentlemen! Jérôme Coupé, in this instance I'm building an embed that will perform some logic to generate retina resolution copies of the images, which requires some logic involving the widths. Oct 25, 2013 at 19:11

1 Answer 1

5

You have an extraneous single quote ' in each of your opening tag pairs.

{stash:ee_img_original_width'}{width_orig}{/stash:ee_img_original_width}

Should be:

{stash:ee_img_original_width}{width_orig}{/stash:ee_img_original_width}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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