<p>Specifically for the image, if I'm correct, you're trying to use imager the wrong way. </p>

<p>It should be</p>

<pre><code>   {% set image = entry.shopImage.first() %}
   {% set shopImageTransform = craft.imager.transformImage(image, { width: 130, height: 170, mode: 'crop', position: 'center-center', jpegQuality: 90 }) %}

   &lt;a href="{{ entry.shopUrl }}" target="_blank" rel="noopener noreferrer"&gt;
      &lt;img src="{{ shopImageTransform.url}}" alt="{{ entry.title }}"/&gt;
   &lt;/a&gt;
</code></pre>

<p>Basically, 'shopImageTransform' becomes the new 'image' so you have to call <code>.url</code> on shopImageTransform instead of on image. You can see an example <a href="https://github.com/aelvan/Imager-Craft#usage" rel="nofollow noreferrer">here</a> , in the Imager readme. </p>

<hr>

<p>As for the problem with the shopUrl, if you just dump it out, what do you receive? Is it holding any value? </p>

CC BY-SA 3.0
2017-07-14T11:35:47.093Z
2017-07-14T11:35:47.093Z
mrsmn
<p>I'm struggling to output images and other fields that are related to the current category page.</p>

<p>So <code>{{ entry.title }}</code> is outputting as expected, and displays the title of the related items to that category. But any other fields do not output.</p>

<pre><code>{% set shopEntries = craft.entries.section(shop).relatedTo(category) %}
{% for entry in shopEntries.limit(16) %}

    {% set image = entry.shopImage.first() %}

    {% set shopImageTransform = craft.imager.transformImage(image, 
    { width: 130, height: 170, mode: 'crop', position: 'center-center', jpegQuality: 90 } 
    ) %}

    &lt;a href="{{ entry.shopUrl }}" target="_blank" rel="noopener noreferrer"&gt;&lt;img src="{{ image.url('shopImageTransform') }}" alt="{{ entry.title }}"/&gt;&lt;/a&gt;

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

<p>This snippet is appearing on a category page, e.g domain.com/category/fashion.</p>

CC BY-SA 3.0
2017-07-07T18:19:10.317Z
What behavior are you seeing? A 404? Blank images?
Brad Bell
CC BY-SA 3.0
2017-07-07T22:34:45.483Z
Hi Brad, <img src="(unknown)" alt="entry title here"/>
Mark
CC BY-SA 3.0
2017-07-07T22:36:27.363Z
Actually, the {{ entry.shopUrl }} isn't outputting either...
Mark
CC BY-SA 3.0
2017-07-11T16:56:48.137Z
Still no  luck with this.. tried everything under the sun! {{ entry.title }} is outputting but  {{ entry.shopUrl }} and {{ entry.shopImage }} is not...
Mark
CC BY-SA 3.0
2017-07-11T23:50:14.667Z
What type of field is `shopUrl`? If you output `{{ entry.id }}`, is it grabbing the entries that you are expecting?
Brad Bell
CC BY-SA 3.0
2017-07-12T14:42:04.770Z
`{{ entry.id }}` outputs as expected as does `{{ entry.title }}`. `{{ entry.shopUrl }}` is a Plain text Field
Mark
CC BY-SA 3.0
2017-07-12T14:48:34.700Z
Is it worth noting that this is being used on a different Category page. So on the Blog Channel category page e.g. http://domain.com/category/fashion I want to output entries from the Shop channel related to the Shop category that is the same as in the URL. Blog and Shop categories are the same so when on the Blog Fashion category page I want to output the Shop Fashion items so basically the shop shows related items to that blog category that is being viewed. Urgh.. make sense?
Mark
CC BY-SA 3.0
2017-07-12T14:54:12.540Z
Each shop items can have more than one category, so if one of them matches the Category in the URL then it needs to show. Uh make sense?
Mark
<assets><plugin-imager>
Can't seem to output fields related to the current category page
# Can't seem to output fields related to the current category page

(Asked by: username_0 on 2017-07-07)

I'm struggling to output images and other fields that are related to the current category page.
So {{ entry.title }} is outputting as expected, and displays the title of the related items to that category. But any other fields do not output.
{% set shopEntries = craft.entries.section(shop).relatedTo(category) %}
{% for entry in shopEntries.limit(16) %}

    {% set image = entry.shopImage.first() %}

    {% set shopImageTransform = craft.imager.transformImage(image, 
    { width: 130, height: 170, mode: 'crop', position: 'center-center', jpegQuality: 90 } 
    ) %}

    

{% endfor %}

This snippet is appearing on a category page, e.g domain.com/category/fashion.

**Tags:** assets, plugin-imager
> **Comments:**
> **username_1**: What behavior are you seeing? A 404? Blank images?  
> **username_0**: Hi Brad, <img src="(unknown)" alt="entry title here"/>  
> **username_0**: Actually, the {{ entry.shopUrl }} isn't outputting either...  
> **username_0**: Still no  luck with this.. tried everything under the sun! {{ entry.title }} is outputting but  {{ entry.shopUrl }} and {{ entry.shopImage }} is not...  
> **username_1**: What type of field is `shopUrl`? If you output `{{ entry.id }}`, is it grabbing the entries that you are expecting?  
> **username_0**: `{{ entry.id }}` outputs as expected as does `{{ entry.title }}`. `{{ entry.shopUrl }}` is a Plain text Field  
> **username_0**: Is it worth noting that this is being used on a different Category page. So on the Blog Channel category page e.g. http://domain.com/category/fashion I want to output entries from the Shop channel related to the Shop category that is the same as in the URL. Blog and Shop categories are the same so when on the Blog Fashion category page I want to output the Shop Fashion items so basically the shop shows related items to that blog category that is being viewed. Urgh.. make sense?  
> **username_0**: Each shop items can have more than one category, so if one of them matches the Category in the URL then it needs to show. Uh make sense?  

---

## 1 answers

### Answer by username_2 on 2017-07-14. Score: 1

Specifically for the image, if I'm correct, you're trying to use imager the wrong way. 
It should be
   {% set image = entry.shopImage.first() %}
   {% set shopImageTransform = craft.imager.transformImage(image, { width: 130, height: 170, mode: 'crop', position: 'center-center', jpegQuality: 90 }) %}

   
      
   

Basically, 'shopImageTransform' becomes the new 'image' so you have to call .url on shopImageTransform instead of on image. You can see an example here , in the Imager readme. 

As for the problem with the shopUrl, if you just dump it out, what do you receive? Is it holding any value?


---

