Re: Can't get sorl.thumbnail to work
{% if profile.user.profile_pic %}
{% thumbnail item.image "50x50" crop="center" as im %}
<img src="{{ profile.profile_pic.url }}"
width="{{ im.width }}" height="{{ im.height }}">
{% endthumbnail %}
{% endif %}
Looks like you have a lot of mistakes in the variables you are referencing above. Your first {% if %} tag refers to profile.user.profile_pic, though I'm almost certain you want to reference profile.profile_pic.
Also, your thumbnail tag should look like this:
{% thumbnail profile.profile_pic "50x50" crop="center" as im %}
Finally, since you are assigning the thumbnail to the im var, you'd want the image src to point to {{ im.url }}, not {{ profile.profile_pic_url }}.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/aHkfCeEY2csJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home