ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Difficulties Using MX_Calc Inside ED_ImageResizer

June 30, 2012 6:20pm

Subscribe [1]
  • #1 / Jun 30, 2012 6:20pm

    Ryan Gibbons

    14 posts

    Hello all,

    I am trying to use MX_Calc to do some basic math on a custom field (columns) to calculate the corresponding width of an image that I am passing to ED_ImageResizer.

    ED_ImageResizer doesn’t output a new image though, it outputs the original uploaded image.  When I replace the maxWidth parameter value with an explicit declaration it does output a sized and cached image.

    I’ve also tried enabling PHP support on the template and executing the math functions that way…same result.

    The truly odd thing is that if I set the class parameter using some match functions as well, it works properly.

    Any ideas?

    <div class="row">
     {exp:channel:entries channel="promotions" url_title="home-page-promotions"}
      {promotions}
       {if promo_active == "Yes"}
        <div class="span{exp:mx_calc expression='{promo_columns}*2'}">
         {exp:ed_imageresizer
          image="{promo_image}"
          maxWidth="{exp:mx_calc expression='({promo_columns}*60)+({promo_columns}*140)-30'}"
          maxHeight="150"
          cropratio="{exp:mx_calc expression='({promo_columns}*60)+({promo_columns}*140)-30'}:150"
          alt="{promo_title}"
          class="span{exp:mx_calc expression='{promo_columns}*2'}"
         }
        </div>
       {/if}
      {/promotions}
     {/exp:channel:entries}
    </div>
.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases