<p>It's a very subtle difference, but what you have added there is a variable, when what you are looking for is a string.</p>

<pre><code>&lt;img src="{{ asset.getUrl('squarePhoto') }}" alt="{{ asset.title }}"&gt;
</code></pre>

<p>Notice the difference?</p>

<p>Your current way would be correct if you had set a variable somewhere with the name of squarePhoto, like so:</p>

<pre><code>{% set squarePhoto = 'transformName' %}
</code></pre>

<p>Check out the <a href="http://buildwithcraft.com/docs/twig-primer">Twig Primer</a> in the Craft docs.</p>

CC BY-SA 3.0
2014-09-24T17:50:54.213Z
Very subtle indeed! Thanks for the description to, it helps to understand the differences
Siebird
CC BY-SA 3.0
2014-09-24T17:19:46.447Z
2014-09-24T17:19:46.447Z
Fred Carlsen
<p>Having issues getting Craft to use a transform I set in the CP: <code>squarePhoto</code>. I keep getting a template error, even though that transform exist.</p>

<blockquote>
  <p>Variable "squarePhoto" does not exist</p>
</blockquote>

<p>The template code in question is:</p>

<pre><code>{% for asset in block.photoImages %}
    &lt;img src="{{ asset.getUrl(squarePhoto) }}" alt="{{ asset.title }}"&gt;
{% endfor %}
</code></pre>

<p>After digging through other threads, I saw that Craft adds a subfolder to the directory with the transform name–this has not been generated. What am I missing? </p>

<p>I've also added the config var <code>'generateTransformsBeforePageLoad' =&gt; true,</code> to my general.php to see if that made a difference.</p>

<assets><image-transforms>
Transforms not working
# Transforms not working

(Asked by: username_0 on 2014-09-24)

Having issues getting Craft to use a transform I set in the CP: squarePhoto. I keep getting a template error, even though that transform exist.

Variable "squarePhoto" does not exist

The template code in question is:
{% for asset in block.photoImages %}
    
{% endfor %}

After digging through other threads, I saw that Craft adds a subfolder to the directory with the transform name–this has not been generated. What am I missing? 
I've also added the config var 'generateTransformsBeforePageLoad' => true, to my general.php to see if that made a difference.

**Tags:** assets, image-transforms


---

## 1 answers

### Answer by username_1 on 2014-09-24. Score: 6 | Accepted answer

It's a very subtle difference, but what you have added there is a variable, when what you are looking for is a string.


Notice the difference?
Your current way would be correct if you had set a variable somewhere with the name of squarePhoto, like so:
{% set squarePhoto = 'transformName' %}

Check out the Twig Primer in the Craft docs.

> **Comments:**
> **username_0**: Very subtle indeed! Thanks for the description to, it helps to understand the differences  

---

