I am trying to show an image that is defined on a category - named photos. I have an entry page with a list of all category entries listed at the bottom. I'd like to show this image but I'm still green on Craft categories and I'm getting errors in dev mode. This is what I have so far:
{% set entries = craft.entries.section('sermons').find() %}
{% for category, catEntries in entries | group('series.first().title') %}
{% if category.photos | length %} {# if a photo exists, show it #}
{% for image in category.photos.limit(1) %}
{% set params = { width: 300, height: 200 } %}
<img src="{{ image.getUrl(params) }}" height="{{ image.getHeight(params) }}" width="{{ image.getWidth(params) }}" alt="">
{% endfor %}
{% else %} {# if no photo exists, show a default image #}
<img src="/img/cover-default.jpg" width="300" height="200" alt=""></a>
{% endif %}
{# output all category entries #}
<ul class="sermonadditional">
{% for entry in catEntries %}
<li><a href="{{ entry.url }}">{{ entry.title }}</a></li>
{% endfor %}
</ul>
{% endfor %}