sorl.thumbnail is not working

62 views
Skip to first unread message

Oana Salageanu

unread,
May 24, 2012, 6:40:16 AM5/24/12
to Django users
I'm not sure what I'm doing wrong, this is my template code:
{% load thumbnail %}

{% thumbnail result.object.image_path|make_thumb "50x50" crop="80%
top" as im %}
<img src="{{ im.url }}">
{% endthumbnail %}

where result.object.image_path|make_thumb, it's something like this:
http://93.XXX.XX.XXX:8000/uploads/files/img/wahanda/name.jpg

I also tried this:

{% thumbnail result.object.image_path "50x50" crop="80% top" as im %}
<img src="{{ im.url }}">
{% endthumbnail %}

where result.object.image_path is /uploads/files/img/wahanda/name.jpg
If I copy the path and put it in my browser, it works, so the path is
ok.

Also, this works:
{% thumbnail "http://www.aino.se/media/i/logo.png" "50x50" crop="80%
top" as im %}
<img src="{{ im.url }}">
{% endthumbnail %}

Any ideas on what i'm doing wrong?
I can't use ImageField in my model since I only store the path.

Any suggestion will be super appreciated.

krzysiekpl

unread,
May 24, 2012, 10:20:55 AM5/24/12
to Django users
Did you correctly set up MEDIA_ROOT in settings ? Sorl-thumbnail only
use files from MEDIA_ROOT try to move uploads/ to media a then use
realtive path to file.

Oana Salageanu

unread,
May 25, 2012, 5:24:02 AM5/25/12
to Django users
The MEDIA_ROOT is set up correctly: MEDIA_ROOT = '/home/myusername/
myprojectname/uploads/'
And the images are stored here: /uploads/files/img/foldername/file.jpg
The relative path, /uploads/files/img/wahanda/name.jpg works..but not
like this:
{% thumbnail result.object.image_path "50x50" crop="80% top" as im %}
<img src="{{ im.url }}">
{% endthumbnail %}



On May 24, 5:20 pm, krzysiekpl <krzysie...@gmail.com> wrote:
> Did you correctly set up MEDIA_ROOT in settings ?Sorl-thumbnailonly
> use files from MEDIA_ROOT try to move uploads/ to media a then use
> realtive path to file.
>
> On 24 Maj, 06:40, Oana Salageanu <oana.salage...@adulmec.ro> wrote:
>
>
>
>
>
>
>
> > I'mnotsure what I'm doing wrong, this is my template code:
Reply all
Reply to author
Forward
0 new messages