<p>Do you not still have to do:</p>

<pre><code>        {% for asset in thumbnailImage %}
            &lt;img src="{{ asset.getUrl(imageTransform) }}" alt="" class="post__preview-img post__preview-img--grid"&gt;
        {% endfor %}
</code></pre>

CC BY-SA 3.0
2016-04-18T14:17:16.210Z
No need for a loop, because they've already got it narrowed down to the `first` thumbnail image. Also `.getUrl` and `.url` are interchangeable (`url` is just an alias).
Lindsey D
CC BY-SA 3.0
2016-04-18T06:58:43.480Z
2016-04-18T06:58:43.480Z
John
<p>The <code>imageTransform</code> value is actually an object, representing the entire dropdown field.</p>

<p>Update the first line to this...</p>

<pre><code>{% set imageTransform = storyEntry.storyThumbnailTransform.value %}
</code></pre>

<p>This will ensure that the selected <strong>value</strong> is passed on, instead of the full object.</p>

<p>(The reason that you see the proper value when you output it directly is because the object's <code>__toString</code> method is automatically being called internally.)</p>

CC BY-SA 3.0
2017-06-16T17:48:29.710Z
Lindsey, could this be used for custom image transforms set on the page? I'm getting the error that says that image transform is not available (and it is available if I type in verbatim).
John Johnson
CC BY-SA 3.0
2017-06-16T17:50:10.753Z
@JohnJohnson Hard to say without looking at your code. I'd recommend [asking a brand new question](https://craftcms.stackexchange.com/questions/ask)... feel free to link back to this thread if relevant.
Lindsey D
CC BY-SA 3.0
2017-06-16T18:01:13.700Z
@LindseyD here is the question: https://craftcms.stackexchange.com/questions/20873/user-selected-image-transform
John Johnson
CC BY-SA 3.0
2016-04-18T05:38:11.853Z
2016-04-18T05:38:11.853Z
Lindsey D
<p>I've created a section with a thumbnail image and also a dropdown to allow the user to select the transformation to apply to that image.</p>

<p>I've pre-created all the asset transformations ready and this is the code I have :</p>

<pre><code>{% set imageTransform = storyEntry.storyThumbnailTransform %}
{% set thumbnailImage = storyEntry.storyThumbnail.first() %}
&lt;img src="{{thumbnailImage.url(imageTransform) }}" alt="" class="post__preview-img post__preview-img--grid"&gt;
</code></pre>

<p>However, it doesn't appear to be rendering the image. If I output <code>storyEntry.storyThumbnailTransform</code> to the page, it displays the value of the image transform as expected.</p>

<p>What am I doing wrong? Or is there another way to accomplish this?</p>

<assets><image>
Using Image Transform as another custom field
# Using Image Transform as another custom field

(Asked by: username_0 on 2016-04-17)

I've created a section with a thumbnail image and also a dropdown to allow the user to select the transformation to apply to that image.
I've pre-created all the asset transformations ready and this is the code I have :
{% set imageTransform = storyEntry.storyThumbnailTransform %}
{% set thumbnailImage = storyEntry.storyThumbnail.first() %}


However, it doesn't appear to be rendering the image. If I output storyEntry.storyThumbnailTransform to the page, it displays the value of the image transform as expected.
What am I doing wrong? Or is there another way to accomplish this?

**Tags:** assets, image

---

## 2 answers

### Answer by username_2 on 2016-04-18. Score: 8 | Accepted answer

The imageTransform value is actually an object, representing the entire dropdown field.
Update the first line to this...
{% set imageTransform = storyEntry.storyThumbnailTransform.value %}

This will ensure that the selected value is passed on, instead of the full object.
(The reason that you see the proper value when you output it directly is because the object's __toString method is automatically being called internally.)

> **Comments:**
> **username_3**: Lindsey, could this be used for custom image transforms set on the page? I'm getting the error that says that image transform is not available (and it is available if I type in verbatim).  
> **username_2**: @JohnJohnson Hard to say without looking at your code. I'd recommend [asking a brand new question](https://craftcms.stackexchange.com/questions/ask)... feel free to link back to this thread if relevant.  
> **username_3**: @LindseyD here is the question: https://craftcms.stackexchange.com/questions/20873/user-selected-image-transform  

---

### Answer by username_1 on 2016-04-18. Score: 0

Do you not still have to do:
        {% for asset in thumbnailImage %}
            
        {% endfor %}

> **Comments:**
> **username_2**: No need for a loop, because they've already got it narrowed down to the `first` thumbnail image. Also `.getUrl` and `.url` are interchangeable (`url` is just an alias).  

---

