I'm having some difficulty with sorl-thumbnail
.
My template is as follows:
{% thumbnail project.image "75x75" crop="center" as im %}
<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}">
{% empty %}
<p>:(</p>
{% endthumbnail %}
In my rendered webpage I get the following path for the thumbnail:
<img src="/media/cache/ff/29/ff299c50543aa807b0fbd28faf271e63.jpg" width="75" height="75">
Now this all makes sense because my MEDIA_URL
is set as /media/
which is mapped in my apache httpd.conf
to a local folder on my server.
The problem is that this path does not exist on the server so the image is displayed as a broken link.
It's worth noting I am using a custom storage object although this shouldn't affect things as it's passed straight through the sorl.thumbnail ImageField
. Also I am using a memcached
cache backend running on the server.
The annoying thing is that I don't get any errors even though I have THUMBNAIL_DEBUG
and DEBUG
on so it's difficult to see what's going wrong. I'm fairly sure it's failing to write the thumbnail files to disk but returning as successful because the {% empty %}
statement doesn't get triggered and the appropriate cache files do not appear on the server. I don't know why though due to the lack of any error.
I'm kinda stuck at this point so any help would be appreciated.
EDIT:
I've given up with sorl now and am using easy-thumbnails instead which is working fine.