<p>You can assign an image to as many entries as you like; what's happening is for some reason, Craft appears to be unable to generate the appropriate image transform. It's very likely some kind of local dev environment setup issue.</p>

<p>For whatever reason, it's unable to access the AssetsController to generate the transformed image on the frontend, as seen in that <code>404</code> url.</p>

CC BY-SA 4.0
2018-05-13T20:27:01.603Z
Thanks @andrew.welch, I understand, but it makes no sense for me... If I change the Featured Image from Article 2 (which was the same as Article 1 has) to something else then everything is working fine again.


I'm using vagrant for my local dev - correct me if I'm wrong, but is this not the "best solution" to simulate the live server?
noxify
CC BY-SA 4.0
2018-05-14T02:07:57.640Z
Yeah Vagrant is a good local dev solution; I use it myself via [Homestead](https://laravel.com/docs/5.6/homestead) -- but you need to make sure the server config is correct.
andrew.welch
CC BY-SA 4.0
2018-05-13T19:33:08.463Z
2018-05-13T19:33:08.463Z
andrew.welch
<p>With the new hints from Andrew (thanks!), I found a good workaround for me based on this answer: <a href="https://craftcms.stackexchange.com/a/21205/8348">https://craftcms.stackexchange.com/a/21205/8348</a></p>

<p>Installing the following plugin:</p>

<ul>
<li><a href="https://github.com/aelvan/Imager-Craft" rel="nofollow noreferrer">https://github.com/aelvan/Imager-Craft</a></li>
</ul>

<p>The updated Frontend Snippet is the following:</p>

<pre><code>{% for entry in latestArticles %}

        {% set asset = entry.featuredImage.one() %}

        {% set transformedImage = craft.imager.transformImage(asset.url, {height: 225}) %}

        &lt;div class="col-md-4"&gt;
            &lt;div class="card mb-4 box-shadow"&gt;
                &lt;img class="card-img-top" src="{{ transformedImage.getUrl() }}"  alt="{{ entry.title }}" style="height: 225px; width: 100%; display: block;" data-holder-rendered="true"&gt;
                &lt;div class="card-body"&gt;
                    &lt;h5 class="card-title"&gt;{{ entry.title }}&lt;/h5&gt;
                    &lt;p class="card-text"&gt;
                        {{ entry.teaser|length &gt; 200 ? entry.teaser|striptags|slice(0, 200) ~ '...' : entry.teaser|striptags }}
                    &lt;/p&gt;
                    &lt;div class="d-flex justify-content-between align-items-center"&gt;
                        &lt;div class="btn-group"&gt;
                            &lt;a href="{{ entry.url }}" class="btn btn-sm btn-outline-secondary"&gt;Read more...&lt;/a&gt;
                        &lt;/div&gt;
                        &lt;small class="text-muted"&gt;9 mins&lt;/small&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
{% endfor %}
</code></pre>

CC BY-SA 4.0
2018-05-14T02:09:43.227Z
So it's good you found a work-around, but something still is not right with your server setup. It shouldn't be throwing a 404 when trying to hit the controller. Check out [Nginx Craft](https://github.com/nystudio107/nginx-craft) assuming you're using Nginx. Also for image, I wrote a plugin called [ImageOptimize](https://github.com/nystudio107/craft-imageoptimize) that you may find useful.
andrew.welch
CC BY-SA 4.0
2018-05-14T19:01:51.373Z
Hi, your image plugin seems to be the perfect solution, because it includes also the `srcset` functionality by default and also the placeholder for lazy load.... i've added the repo to my watch list. For now i will continue with the `imager` plugin - but thanks a lot for your help.
noxify
CC BY-SA 4.0
2018-05-13T20:53:16.247Z
2018-05-13T20:53:16.247Z
noxify
<p>I have currently the problem, that I can't use the same asset in different entries as featured image.</p>

<p>Craft Pro Version: 3.0.9</p>

<p>My setup is the following:</p>

<p>Volumes:</p>

<ul>
<li>Local, Base URL: <code>@web/uploads</code>, Type: Local, File Path: <code>@webroot/uploads</code></li>
</ul>

<p>Created Fields:</p>

<ul>
<li>Featured Image, Type: Asset, Limit: 1, Volume: Local</li>
</ul>

<p>Created Section:</p>

<ul>
<li>Articles, Type Channel, Added <code>Featured Image</code> to the post type</li>
</ul>

<hr>

<p>Now I have uploaded some dummy images. (e.g. Image 1, Image 2, Image 3)
After this I have created some article entries.</p>

<ul>
<li>Article 1 - Image 1</li>
<li>Article 2 - Image 2</li>
<li>Article 3 - Image 3</li>
</ul>

<p>Backend Preview:
<a href="https://i.sstatic.net/LuV51.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/LuV51.png" alt="enter image description here"></a></p>

<p>Frontend Preview:
<a href="https://i.sstatic.net/aIu1K.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/aIu1K.jpg" alt="enter image description here"></a></p>

<p>When I change the <code>Article 1 - Featured Image</code> from <code>Image 1</code> to <code>Image 2</code> it looks good in the backend but not in the frontend.</p>

<p>Backend Preview:
<a href="https://i.sstatic.net/u4lXu.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/u4lXu.png" alt="enter image description here"></a></p>

<p>Frontend Preview:
<a href="https://i.sstatic.net/E8O5G.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/E8O5G.jpg" alt="enter image description here"></a></p>

<p>The frontend snippet to show the entries is the following:</p>

<pre><code>{% set latestArticles = craft.entries({section: 'articles', limit: 6}).orderBy('id desc').all() %}

&lt;div class="container"&gt;

    &lt;div class="row card-columns"&gt;

    {% for entry in latestArticles %}

        {% set asset = entry.featuredImage.one() %}

        &lt;div class="col-md-4"&gt;
            &lt;div class="card mb-4 box-shadow"&gt;
                &lt;img class="card-img-top" src="{{ asset.getUrl('thumb') }}"  alt="{{ entry.title }}" style="height: 225px; width: 100%; display: block;" data-holder-rendered="true"&gt;
                &lt;div class="card-body"&gt;
                    &lt;h5 class="card-title"&gt;{{ entry.title }}&lt;/h5&gt;
                    &lt;p class="card-text"&gt;
                        {{ entry.teaser|length &gt; 200 ? entry.teaser|striptags|slice(0, 200) ~ '...' : entry.teaser|striptags }}
                    &lt;/p&gt;
                    &lt;div class="d-flex justify-content-between align-items-center"&gt;
                        &lt;div class="btn-group"&gt;
                            &lt;a href="{{ entry.url }}" class="btn btn-sm btn-outline-secondary"&gt;Read more...&lt;/a&gt;
                        &lt;/div&gt;
                        &lt;small class="text-muted"&gt;9 mins&lt;/small&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    {% endfor %}
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>The question is now the following:</p>

<ul>
<li>Is it an user handling?! :D</li>
<li>Is it not possible to assign one image to multiple entries?</li>
<li>Is there any workaround? (please don't tell me, to upload the image again ;) ) </li>
</ul>

<p>Thanks!</p>

<entries><assets><craft3><assets-field>
How to use an asset as featured image in different entries
# How to use an asset as featured image in different entries

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

I have currently the problem, that I can't use the same asset in different entries as featured image.
Craft Pro Version: 3.0.9
My setup is the following:
Volumes:

Local, Base URL: @web/uploads, Type: Local, File Path: @webroot/uploads

Created Fields:

Featured Image, Type: Asset, Limit: 1, Volume: Local

Created Section:

Articles, Type Channel, Added Featured Image to the post type


Now I have uploaded some dummy images. (e.g. Image 1, Image 2, Image 3)
After this I have created some article entries.

Article 1 - Image 1
Article 2 - Image 2
Article 3 - Image 3

Backend Preview:

Frontend Preview:

When I change the Article 1 - Featured Image from Image 1 to Image 2 it looks good in the backend but not in the frontend.
Backend Preview:

Frontend Preview:

The frontend snippet to show the entries is the following:
{% set latestArticles = craft.entries({section: 'articles', limit: 6}).orderBy('id desc').all() %}



    

    {% for entry in latestArticles %}

        {% set asset = entry.featuredImage.one() %}

        
            
                
                
                    {{ entry.title }}
                    
                        {{ entry.teaser|length > 200 ? entry.teaser|striptags|slice(0, 200) ~ '...' : entry.teaser|striptags }}
                    
                    
                        
                            Read more...
                        
                        9 mins
                    
                
            
        
    {% endfor %}
    


The question is now the following:

Is it an user handling?! :D
Is it not possible to assign one image to multiple entries?
Is there any workaround? (please don't tell me, to upload the image again ;) ) 

Thanks!

**Tags:** entries, assets, craft3, assets-field


---

## 2 answers

### Answer by username_1 on 2018-05-13. Score: 1

You can assign an image to as many entries as you like; what's happening is for some reason, Craft appears to be unable to generate the appropriate image transform. It's very likely some kind of local dev environment setup issue.

For whatever reason, it's unable to access the AssetsController to generate the transformed image on the frontend, as seen in that `404` url.

> **Comments:**
> **username_0**: Thanks @username_1, I understand, but it makes no sense for me... If I change the Featured Image from Article 2 (which was the same as Article 1 has) to something else then everything is working fine again.   I'm using vagrant for my local dev - correct me if I'm wrong, but is this not the "best solution" to simulate the live server?  
> **username_1**: Yeah Vagrant is a good local dev solution; I use it myself via [Homestead](https://laravel.com/docs/5.6/homestead) -- but you need to make sure the server config is correct.  

---

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

With the new hints from Andrew (thanks!), I found a good workaround for me based on this answer: https://craftcms.stackexchange.com/a/21205/8348
Installing the following plugin:

https://github.com/aelvan/Imager-Craft

The updated Frontend Snippet is the following:
{% for entry in latestArticles %}

        {% set asset = entry.featuredImage.one() %}

        {% set transformedImage = craft.imager.transformImage(asset.url, {height: 225}) %}

        
            
                
                
                    {{ entry.title }}
                    
                        {{ entry.teaser|length > 200 ? entry.teaser|striptags|slice(0, 200) ~ '...' : entry.teaser|striptags }}
                    
                    
                        
                            Read more...
                        
                        9 mins
                    
                
            
        
{% endfor %}

> **Comments:**
> **username_1**: So it's good you found a work-around, but something still is not right with your server setup. It shouldn't be throwing a 404 when trying to hit the controller. Check out [Nginx Craft](https://github.com/nystudio107/nginx-craft) assuming you're using Nginx. Also for image, I wrote a plugin called [ImageOptimize](https://github.com/nystudio107/craft-imageoptimize) that you may find useful.  
> **username_0**: Hi, your image plugin seems to be the perfect solution, because it includes also the `srcset` functionality by default and also the placeholder for lazy load.... i've added the repo to my watch list. For now i will continue with the `imager` plugin - but thanks a lot for your help.  

---

