<p>Aha!!! Got it working at last!!</p>

<p>As I was using Live Preview, even though I was set to Dev Mode for any errors, they weren't showing in the Live Preview pane <em>(maybe that should be a feature request?)</em>.</p>

<p>As soon as I tested it out on the live page I saw an error and it told me to place parentheses around an expression so I did this instead :</p>

<p><strong>quality: (block.quality.value)</strong> and all is good with the world now!! :-)</p>

CC BY-SA 3.0
2015-05-13T22:54:24.603Z
2015-05-13T22:54:24.603Z
Mark Bowen
<p>Hope I'm not posting incorrectly here but don't have enough reputation yet <em>(really don't understand that system at all)</em> to be able to comment on another post here on the exchange.</p>

<p>Original Post - <a href="https://craftcms.stackexchange.com/questions/6783/inline-image-transforms">inline image transforms</a></p>

<p>I'd like to get this to work but not having any luck at all. This is my code in my template so far.</p>

<pre><code>{% for block in entry.matrixBlocks %}

    {% if block.type == "text" %}

    &lt;p&gt;{{ block.text }}&lt;/p&gt;

    {% elseif block.type == "quote" %}

    &lt;blockquote class="{{ block.floatPosition }}"&gt;
    &lt;p&gt;{{ block.quote }}&lt;/p&gt;
    &lt;/blockquote&gt;

    {% elseif block.type == "image" %}

    {% set smallImage
        = {
        mode: 'fit',
        width: 600,
        height: 200,
        quality: {{ block.quality.value }},
        position: 'top-center'
        }
    %}

    {% for asset in block.image %}
    &lt;img src="{{ asset.getUrl(smallImage) }}"
    width="{{ asset.getWidth(smallImage) }}"
    height="{{ asset.getHeight(smallImage) }}"&gt;
    {% endfor %}
    {% endif %}

{% endfor %}
</code></pre>

<p>The <strong>quality</strong> in <em>{{ block.quality.value }}</em> is the name <strong>(handle)</strong> of a field I have storing a number from <strong>1-100</strong> in my Matrix Block. I am using <a href="https://github.com/MaxLazar/mx-rangeslider-craftcms" rel="nofollow noreferrer">Max Lazars range field</a> to store the number.</p>

<p>Upon trying this say by Live Preview the page never refreshes. If I change the <strong>{{ block.quality.value }}</strong> to a number then it all works again as expected.</p>

<p>Would love to get this working so any help would be greatly appreciated to let me know where I'm going wrong.</p>

<p>Thanks,</p>

<p>Mark</p>

CC BY-SA 3.0
2015-05-13T22:50:48.733Z
Aha!!! Got it working at last!!

As I was using Live Preview, even though I was set to Dev Mode for any errors, they weren't showing in the Live Preview pane *(maybe that should be a feature request?)*.

As soon as I tested it out on the live page I saw an error and it told me to place parentheses around an expression so I did this instead quality: (block.quality.value) and all is good with the world now!! :-)
Mark Bowen
<assets><matrix><image><range>
Inline image transform using Matrix field for image quality?
# Inline image transform using Matrix field for image quality?

(Asked by: username_0 on 2015-05-13)

Hope I'm not posting incorrectly here but don't have enough reputation yet (really don't understand that system at all) to be able to comment on another post here on the exchange.
Original Post - inline image transforms
I'd like to get this to work but not having any luck at all. This is my code in my template so far.
{% for block in entry.matrixBlocks %}

    {% if block.type == "text" %}

    {{ block.text }}

    {% elseif block.type == "quote" %}

    
    {{ block.quote }}
    

    {% elseif block.type == "image" %}

    {% set smallImage
        = {
        mode: 'fit',
        width: 600,
        height: 200,
        quality: {{ block.quality.value }},
        position: 'top-center'
        }
    %}

    {% for asset in block.image %}
    
    {% endfor %}
    {% endif %}

{% endfor %}

The quality in {{ block.quality.value }} is the name (handle) of a field I have storing a number from 1-100 in my Matrix Block. I am using Max Lazars range field to store the number.
Upon trying this say by Live Preview the page never refreshes. If I change the {{ block.quality.value }} to a number then it all works again as expected.
Would love to get this working so any help would be greatly appreciated to let me know where I'm going wrong.
Thanks,
Mark

**Tags:** assets, matrix, image, range

> **Comments:**
> **username_0**: Aha!!! Got it working at last!!  As I was using Live Preview, even though I was set to Dev Mode for any errors, they weren't showing in the Live Preview pane *(maybe that should be a feature request?)*.  As soon as I tested it out on the live page I saw an error and it told me to place parentheses around an expression so I did this instead quality: (block.quality.value) and all is good with the world now!! :-)  

---

## 1 answers

### Answer by username_0 on 2015-05-13. Score: 1

Aha!!! Got it working at last!!

As I was using Live Preview, even though I was set to Dev Mode for any errors, they weren't showing in the Live Preview pane *(maybe that should be a feature request?)*.

As soon as I tested it out on the live page I saw an error and it told me to place parentheses around an expression so I did this instead :

**quality: (block.quality.value)** and all is good with the world now!! :-)


---

