Wednesday, May 16, 2012

Re: Can't get sorl.thumbnail to work

Like a charm!

Thanks for your patience. I was working on this, my first django project, for months then put it away two months ago when things got too hectic. Still brushing off the cobwebs with some things,

Many, many thanks.



On Wednesday, May 16, 2012 9:43:34 PM UTC-4, Irfan Baig wrote:
    {% 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/-/EGZA9A-tQL0J.
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


Real Estate