Avatar will not render (Reopening as a Bug Report)
mitchellgemma opened this issue · comments
Describe the bug
When calling {{ craft.comments.render(entry.id) }} and using the default template, the photos for users do not render properly. In the src for the photo, it only says the file name, and does not include the path to the file. Also, when trying to select a default user photo in the Craft admin panel, no existing pictures load and I am told a server error has occured.
Steps to reproduce
- Any new comments from different users still do not render
Craft CMS version
4.2.5.1
Plugin version
2.0.2.1
Multi-site?
No
Additional context
Here are the volume settings that are configured for the 'User Photo Location'
For anyone experiencing a similar issue, here is the code I used to fix this issue. Reach out if you have any additional questions!
{% if comment.can('showAvatar') %}
{% set avatar = comment.author.getPhoto() %}
{% if avatar %}
{% if avatar is iterable %}
<img src="{{ avatar.url({ width: 64, height: 64, mode: 'fit' }) }}" />
{% else %}
<img src="{{ avatar }}" />
{% endif %}
{% else %}
<span class="cc-i-image-icon"></span>
{% endif %}
</p>
</figure>
{% endif %}
Hope this helps someone!
Should be fixed for the next release. To get this early, change your verbb/comments
requirement in composer.json
to:
"require": {
"verbb/comments": "dev-craft-4 as 2.0.2.1",
"...": "..."
}
Then run composer update
.
Fixed in 2.0.3