Question

I have working solr-thumbnail in several parts of my project, but this time I want to display an image from a URL, I have it like this:

    {% load thumbnail %}
    {% thumbnail profile_picture_url "150x150" crop="center" as img %}
    <img src="{{ img }}">
    {% endthumbnail %}

The view passes the value profile_picture_url as "http://....image.jpg". The image is correctly displayed if I just use:

<img src="{{ profile_picture_url }}">

What am I doing wrong ?

Thank you

Was it helpful?

Solution

SORL-Thumbnail is looking for the image object, not the URL. Pass it profile_picture instead of profile_picture_url and then call the url attribute of img in the src attribute of the img tag.

{% load thumbnail %}
{% thumbnail profile_picture "150x150" crop="center" as img %}
  <img src="{{ img.url }}">
{% endthumbnail %}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top