]> git.0d.be Git - panikweb.git/commitdiff
switch thumbnail system from homegrown to sorl-thumbnail
authorFrédéric Péters <fpeters@0d.be>
Mon, 25 May 2015 08:45:39 +0000 (10:45 +0200)
committerFrédéric Péters <fpeters@0d.be>
Mon, 25 May 2015 08:45:39 +0000 (10:45 +0200)
22 files changed:
panikweb/paniktags/templatetags/thumbnails.py [deleted file]
panikweb/settings.py
panikweb_templates/templates/emissions/emission_detail.html
panikweb_templates/templates/emissions/episode_detail.html
panikweb_templates/templates/emissions/newsitem_detail.html
panikweb_templates/templates/emissions/resume.html
panikweb_templates/templates/episodes/detail.html
panikweb_templates/templates/episodes/inline.html
panikweb_templates/templates/episodes/resume.html
panikweb_templates/templates/feed/newsitem.html
panikweb_templates/templates/feed/soundfile.html
panikweb_templates/templates/home.html
panikweb_templates/templates/listen.html
panikweb_templates/templates/news/archives.html
panikweb_templates/templates/news/inline.html
panikweb_templates/templates/news/roll.html
panikweb_templates/templates/panikombo/audio.html
panikweb_templates/templates/panikombo/episode.html
panikweb_templates/templates/party.html
panikweb_templates/templates/soundfiles/resume.html
requirements.txt
setup.py

diff --git a/panikweb/paniktags/templatetags/thumbnails.py b/panikweb/paniktags/templatetags/thumbnails.py
deleted file mode 100644 (file)
index 75ec6ff..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
-# initiated from http://djangosnippets.org/snippets/2145/
-
-import os
-import re
-from PIL import Image
-
-from django.conf import settings
-
-from django.db.models.signals import post_save, pre_delete
-from django.template import Library
-
-register = Library()
-
-def thumbnail(image, size='100x100'):
-    # defining the size
-    x, y = [int(x) for x in size.split('x')]
-    # defining the filename and the miniature filename
-    try:
-        filehead, filetail = os.path.split(image.path)
-    except (AttributeError, ValueError):
-        # return transparent pixel if the image doesn't actually exist
-        return 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII='
-    basename, format = os.path.splitext(filetail)
-    if format.lower() not in ('.jpg', '.jpeg'):
-        format = '.png'
-    miniature = basename + '__' + size + format
-    filename = image.path
-    miniature_filename = os.path.join(filehead, miniature)
-    filehead, filetail = os.path.split(image.url)
-    miniature_url = filehead + '/' + miniature
-    if os.path.exists(miniature_filename) and \
-            os.path.getmtime(filename) > os.path.getmtime(miniature_filename):
-        os.unlink(miniature_filename)
-    # if the image wasn't already resized, resize it
-    if not os.path.exists(miniature_filename) and os.path.exists(filename):
-        image = Image.open(filename)
-        if abs( (1.0*x/y) - (1.0*image.size[0]/image.size[1]) ) > 0.1:
-            # aspect ratio change, crop the image first
-            box = [0, 0, image.size[0], int(image.size[0] * (1.0*y/x))]
-
-            if box[2] > image.size[0]:
-                box = [int(t*(1.0*image.size[0]/box[2])) for t in box]
-            if box[3] > image.size[1]:
-                box = [int(t*(1.0*image.size[1]/box[3])) for t in box]
-
-            if image.size[0] > image.size[1]: # landscape
-                box[0] = (image.size[0] - box[2]) / 2 # keep the middle
-                box[2] += box[0]
-            else:
-                box[1] = (image.size[1] - box[3]) / 4 # keep mostly the top
-                box[3] += box[1]
-
-            image = image.crop(box)
-        image = image.resize([x, y], Image.ANTIALIAS)
-        try:
-            image.save(miniature_filename, image.format, quality=90, optimize=1)
-        except:
-            image.save(miniature_filename, image.format, quality=90)
-
-    return miniature_url
-
-
-register.filter(thumbnail)
-
-
-def clean_thumb(sender, instance, **kwargs):
-    if not hasattr(instance, 'image'):
-        return
-    if not instance.image:
-        return
-    name, ext = os.path.splitext(os.path.basename(instance.image.name))
-    exp = '^%s__\d+x\d+x[0-1]{1}\%s' % (name, ext)
-    for file_path in os.listdir(settings.MEDIA_ROOT):
-        if re.search(exp, file_path):
-            os.unlink(settings.MEDIA_ROOT + file_path)
-
-
-post_save.connect(clean_thumb)
-pre_delete.connect(clean_thumb)
index b7ac0ca84bdffb2243129471513c5393950e17cd..2e72faa735b15ba42fd3a820bcdaa8e99b22cf65 100644 (file)
@@ -145,6 +145,7 @@ INSTALLED_APPS = (
     'panikweb.paniktags',
     'mptt',
     'compressor',
     'panikweb.paniktags',
     'mptt',
     'compressor',
+    'sorl.thumbnail',
     'jquery',
     'ckeditor',
     'emissions',
     'jquery',
     'ckeditor',
     'emissions',
index 0d8a0cb51d277a83a152cce31041e29de7f66863..386068cdabd9bab7c114e782f46a616d626c9a9f 100644 (file)
@@ -1,5 +1,5 @@
 {% extends "emissions.html" %}
 {% extends "emissions.html" %}
-{% load paniktags thumbnails staticfiles i18n %}
+{% load paniktags staticfiles i18n %}
 {% block bodyID %}Emissions{% endblock %}
 {% block title %}{{ emission.title }}{% endblock %}
 
 {% block bodyID %}Emissions{% endblock %}
 {% block title %}{{ emission.title }}{% endblock %}
 
index ac2f4f73eb14240c78e7604073b613fc00eacd0f..bb047d801fddaa147f2fccc6833105a9061e7cf9 100644 (file)
@@ -1,5 +1,5 @@
 {% extends "emissions/emission_detail.html" %}
 {% extends "emissions/emission_detail.html" %}
-{% load paniktags thumbnails staticfiles soundfiles %}
+{% load paniktags staticfiles soundfiles %}
 {% block title %}{{ episode.title }} - {{ episode.emission.title }} {% endblock %}
 
 {% block head %}
 {% block title %}{{ episode.title }} - {{ episode.emission.title }} {% endblock %}
 
 {% block head %}
index d1f2896753359d56ba334eb9e2f407b6489f613f..e59d0396a19aa17da95aab73396a2a173f3f033d 100644 (file)
@@ -1,5 +1,5 @@
 {% extends "news.html" %}
 {% extends "news.html" %}
-{% load i18n thumbnails paniktags %}
+{% load i18n paniktags %}
 {% block title %}{{ newsitem.title }}{% endblock %}
 
 {% block toptitle %}
 {% block title %}{{ newsitem.title }}{% endblock %}
 
 {% block toptitle %}
index 2cfa9f4c9ba462690d000baca971c74ca75446cd..0a1867887796543fa454c5d03ad73f1e4401f8e2 100644 (file)
@@ -1,10 +1,12 @@
-{% load thumbnails staticfiles %}
+{% load thumbnail staticfiles %}
 <div class="emission emission-resume resume cf">
        <div class="{% if emission.archived %}archived{% endif %}">
                <a class="block" href="{% url 'emission-view' slug=emission.slug %}">
                        <div class="logo left">
                                {% if emission.image %}
 <div class="emission emission-resume resume cf">
        <div class="{% if emission.archived %}archived{% endif %}">
                <a class="block" href="{% url 'emission-view' slug=emission.slug %}">
                        <div class="logo left">
                                {% if emission.image %}
-                                       <img width="60" height="60" src="{{ emission.image|thumbnail:'60x60' }}"/>
+                                       {% thumbnail emission.image "60x60" crop="50% 25%" as im %}
+                                       <img width="60" height="60" src="{{im.url}}"/>
+                                       {% endthumbnail %}
                                {% else %}
                                        <img class="smooth"  style="width:60px;" src="{% static "img/emission.png" %}"/>
                                {% endif %}
                                {% else %}
                                        <img class="smooth"  style="width:60px;" src="{% static "img/emission.png" %}"/>
                                {% endif %}
index d6730a451987d07b08c96c46ebca1968c5a22022..99043eb77adff767ddf8438161715a306a07ba0e 100644 (file)
@@ -1,4 +1,4 @@
-{% load thumbnails paniktags %}
+{% load thumbnail paniktags %}
 <div class="episode detail episode-detail cf">
        {% if episode.first_diffusion %}
        <div class="dateBloc">
 <div class="episode detail episode-detail cf">
        {% if episode.first_diffusion %}
        <div class="dateBloc">
@@ -45,7 +45,9 @@
        {% endif %}
        <div class="content userContent marged">
                {% if episode.image %}
        {% endif %}
        <div class="content userContent marged">
                {% if episode.image %}
-               <img class="logo right button" data-toggle-img="/media/{{episode.image}}" src="{{ episode.image|thumbnail:'640x480' }}"/>
+               {% thumbnail emission.image "640x480" crop="50% 25%" as im %}
+               <img class="logo right button" data-toggle-img="/media/{{episode.image}}" src="{{im.url}}"/>
+               {% endthumbnail %}
                {% endif %}
                {% if episode.text %}
                <article class="text">
                {% endif %}
                {% if episode.text %}
                <article class="text">
index 5fb6548c6a5d156578634696c70e7d556fc4e311..0fa453403302341075b491516d468473335fbebe 100644 (file)
@@ -1,10 +1,14 @@
-{% load thumbnails paniktags staticfiles %}
+{% load thumbnail paniktags staticfiles %}
 <div class="episode inline episode-inline">
        <div class="logo">
                {% if episode.image %}
 <div class="episode inline episode-inline">
        <div class="logo">
                {% if episode.image %}
-                       <img src="{{ episode.image|thumbnail:'60x60' }}"/>
+                       {% thumbnail episode.image "60x60" crop="50% 25%" as im %}
+                       <img src="{{im.url}}"/>
+                       {% endthumbnail %}
                {% elif episode.emission.image %}
                {% elif episode.emission.image %}
-                       <img src="{{ episode.emission.image|thumbnail:'60x60' }}"/>
+                       {% thumbnail episode.emission.image "60x60" crop="50% 25%" as im %}
+                       <img src="{{im.url}}"/>
+                       {% endthumbnail %}
                {% else %}
                        <img class="smooth"  style="width:60px;" src="{% static "img/emission.png" %}"/>
                {% endif %}
                {% else %}
                        <img class="smooth"  style="width:60px;" src="{% static "img/emission.png" %}"/>
                {% endif %}
index 929e61291e3cfc2819f5d7caab26dfd804942fa6..b004c4695991746edf8b9d3e4974c68fdca6b019 100644 (file)
@@ -1,4 +1,4 @@
-{% load thumbnails paniktags staticfiles %}
+{% load thumbnail paniktags staticfiles %}
 <div class="episode {% if model %}{{ model }}{% else %}resume{% endif %} cf {{ class }}">
        {% if date != False %}
        <div class="dateBloc">
 <div class="episode {% if model %}{{ model }}{% else %}resume{% endif %} cf {{ class }}">
        {% if date != False %}
        <div class="dateBloc">
        <div class="logo">
                <a href="{% url 'episode-view' emission_slug=episode.emission.slug slug=episode.slug %}">
                {% if model = "inline" and episode.image %}
        <div class="logo">
                <a href="{% url 'episode-view' emission_slug=episode.emission.slug slug=episode.slug %}">
                {% if model = "inline" and episode.image %}
-                       <img width="60" height="60" src="{{ episode.image|thumbnail:'60x60' }}"/>
+                       {% thumbnail episode.image "60x60" crop="50% 25%" as im %}
+                       <img width="60" height="60" src="{{im.url}}"/>
+                       {% endthumbnail %}
                {% elif model = "inline" and episode.emission.image %}
                {% elif model = "inline" and episode.emission.image %}
-                       <img width="60" height="60" src="{{ episode.emission.image|thumbnail:'60x60' }}"/>
+                       {% thumbnail emission.episode.image "60x60" crop="50% 25%" as im %}
+                       <img width="60" height="60" src="{{im.url}}"/>
+                       {% endthumbnail %}
                {% elif model = "inline" %}
                        <img class="smooth"  style="width:60px;" src="{% static "img/emission.png" %}"/>
                {% elif episode.image %}
                {% elif model = "inline" %}
                        <img class="smooth"  style="width:60px;" src="{% static "img/emission.png" %}"/>
                {% elif episode.image %}
-                       <img src="{{ episode.image|thumbnail:'150x150' }}"/>
+                       {% thumbnail episode.image "150x150" crop="50% 25%" as im %}
+                       <img width="150" height="150" src="{{im.url}}"/>
+                       {% endthumbnail %}
                {% elif episode.emission.image %}
                {% elif episode.emission.image %}
-                       <img src="{{ episode.emission.image|thumbnail:'150x150' }}"/>
+                       {% thumbnail episode.emission.image "150x150" crop="50% 25%" as im %}
+                       <img width="150" height="150" src="{{im.url}}"/>
+                       {% endthumbnail %}
                {% else %}
                        <img class="smooth" style="width:150px;" src="{% static "img/emission.png" %}"/>
                {% endif %}
                {% else %}
                        <img class="smooth" style="width:150px;" src="{% static "img/emission.png" %}"/>
                {% endif %}
index 497a0edf93e7f0cc108dbda9f56fd9668a1854b7..b1c06129ca75c61a2b9fe1749ff98f33e208734d 100644 (file)
@@ -1,6 +1,8 @@
-{% load thumbnails %}
+{% load thumbnail %}
 {% if obj.image %}
 {% if obj.image %}
-<img src="{{ obj.image|thumbnail:'320x240' }}"/>
+{% thumbnail obj.image "320x240" crop="50% 25%" as im %}
+<img src="{{im.url}}"/>
+{% endthumbnail %}
 {% endif %}
 
 {% autoescape off %}
 {% endif %}
 
 {% autoescape off %}
index 116c3decdaa33077a087290bafd20dc207882a00..f14fdabd54c4637b3aad724a391c8ee86270d935 100644 (file)
@@ -1,6 +1,8 @@
-{% load thumbnails %}
+{% load thumbnail %}
 {% if obj.episode.image %}
 {% if obj.episode.image %}
-<img src="{{ obj.episode.image|thumbnail:'320x240' }}"/>
+{% thumbnail obj.episode.image "320x240" crop="50% 25%" as im %}
+<img src="{{im.url}}"/>
+{% endthumbnail %}
 {% endif %}
 
 {% autoescape off %}
 {% endif %}
 
 {% autoescape off %}
index 68d7b1fd24f72a6236f5354841746faa85a42c72..3c6435608eab920fa0329741c88d1d73c5ad9cf6 100644 (file)
@@ -1,5 +1,5 @@
 {% extends "base.html" %}
 {% extends "base.html" %}
-{% load thumbnails paniktags staticfiles i18n %}
+{% load paniktags staticfiles i18n %}
 {% block bodyID %}Home{% endblock %}
 {% block title %}{% trans 'Home' %}{% endblock %}
 
 {% block bodyID %}Home{% endblock %}
 {% block title %}{% trans 'Home' %}{% endblock %}
 
index 986cd0ac120a136e86191ceca03971b017c280ad..a368cbb056b26f4a0cfeb7c717de3663c28bdb3e 100644 (file)
@@ -1,5 +1,5 @@
 {% extends "base.html" %}
 {% extends "base.html" %}
-{% load paniktags staticfiles thumbnails i18n %}
+{% load paniktags staticfiles thumbnail i18n %}
 {% block title %}{% trans 'Sounds' %}{% endblock %}
 {% block toptitle %}
 <h1 class="top"><a href="{% url 'listen' %}">{% trans 'Sounds' %}</a></h1>
 {% block title %}{% trans 'Sounds' %}{% endblock %}
 {% block toptitle %}
 <h1 class="top"><a href="{% url 'listen' %}">{% trans 'Sounds' %}</a></h1>
                 </div>
                 <div class="logo">
                   {% if soundfile.episode.image %}
                 </div>
                 <div class="logo">
                   {% if soundfile.episode.image %}
-                  <img class="normal" src="{{ soundfile.episode.image|thumbnail:'480x320' }}"/>
+                  {% thumbnail soundfile.episode.image "480x320" crop="50% 25%" as im %}
+                  <img class="normal" src="{{im.url}}"/>
+                  {% endthumbnail %}
                   {% elif soundfile.episode.emission.image %}
                   {% elif soundfile.episode.emission.image %}
-                  <img class="normal" src="{{ soundfile.episode.emission.image|thumbnail:'480x320' }}"/>
+                  {% thumbnail soundfile.episode.emission.image "480x320" crop="50% 25%" as im %}
+                  <img class="normal" src="{{im.url}}"/>
+                  {% endthumbnail %}
                   {% else %}
                   <img class="normal" src="{% static "img/sound.png" %}"/>
                   {% endif %}
                   {% else %}
                   <img class="normal" src="{% static "img/sound.png" %}"/>
                   {% endif %}
index c330e440d0ca179e447a3238d99a890750928bec..fc444fdbff24eadf10e934d2c6a7cb5f55edd276 100644 (file)
@@ -1,5 +1,5 @@
 {% extends "news.html" %}
 {% extends "news.html" %}
-{% load thumbnails paniktags i18n %}
+{% load paniktags i18n %}
 {% block title %}{% trans 'News' %} - Archives{% endblock %}
 {% block nav %}
        <div class="search-filters">
 {% block title %}{% trans 'News' %} - Archives{% endblock %}
 {% block nav %}
        <div class="search-filters">
index b85bf527095a32f736eb1fe324d4e69ccb0df2ce..677a43b933532adc8b65dd20f87f77b7e813ee04 100644 (file)
@@ -1,4 +1,4 @@
-{% load thumbnails staticfiles %}
+{% load thumbnail staticfiles %}
 <div class="content content-inline {% if class != "special" %}inline{% endif %} cf {{ class }}">
        <a class="block cf" href="{% url 'newsitem-view' slug=content.slug %}">
                {% if class == "special" and content.category %}
 <div class="content content-inline {% if class != "special" %}inline{% endif %} cf {{ class }}">
        <a class="block cf" href="{% url 'newsitem-view' slug=content.slug %}">
                {% if class == "special" and content.category %}
@@ -9,11 +9,17 @@
 
                <div class="logo">
                {% if class == "special" and content.image %}
 
                <div class="logo">
                {% if class == "special" and content.image %}
-                       <img class="normal" src="{{ content.image|thumbnail:'480x320' }}"/>
+                       {% thumbnail content.image "480x320" crop="50% 25%" as im %}
+                       <img class="normal" src="{{im.url}}"/>
+                       {% endthumbnail %}
                {% elif content.image %}
                {% elif content.image %}
-                       <img class="left" width="60" height="60" src="{{ content.image|thumbnail:'60x60' }}"/>
+                       {% thumbnail content.image "60x60" crop="50% 25%" as im %}
+                       <img class="left" width="60" height="60" src="{{im.url}}"/>
+                       {% endthumbnail %}
                {% elif content.emission.image %}
                {% elif content.emission.image %}
-                       <img class="left" width="60" height="60" src="{{ content.emission.image|thumbnail:'60x60' }}"/>
+                       {% thumbnail content.emission.image "60x60" crop="50% 25%" as im %}
+                       <img class="left" width="60" height="60" src="{{im.url}}"/>
+                       {% endthumbnail %}
                {% else %}
                        <img class="left" width="60" height="60" src="{% static "img/actu.png" %}"/>
                {% endif %}
                {% else %}
                        <img class="left" width="60" height="60" src="{% static "img/actu.png" %}"/>
                {% endif %}
index 3109996e440f8bad87423ad646fad512a979fc56..dde2a92e918c38833746381df76916d5e03d453d 100644 (file)
@@ -1,4 +1,4 @@
-{% load thumbnails i18n paniktags %}
+{% load thumbnail i18n paniktags %}
 <div id="newsRoll">
        <div class="newsRoll center cf">
                <ul id="ticker" class="custom bigNews marged" style="height:300px;overflow:hidden;">
 <div id="newsRoll">
        <div class="newsRoll center cf">
                <ul id="ticker" class="custom bigNews marged" style="height:300px;overflow:hidden;">
@@ -7,7 +7,9 @@
                     id="newsRollId-{{ focus.id }}"
                     class="">
                                        <a 
                     id="newsRollId-{{ focus.id }}"
                     class="">
                                        <a 
-                        style="max-width:100%;height:300px;background: no-repeat 50% 50% url('{{ focus.content_image|thumbnail:'500x375' }}');"
+                   {% thumbnail focus.content_image "500x375" crop="50% 25%" as im %}
+                        style="max-width:100%;height:300px;background: no-repeat 50% 50% url('{{im.url}}');"
+                       {% endthumbnail %}
                         class="block news relative"
                        href="{{ focus|get_focus_url }}">
                                                {% if focus.content_category_title %}
                         class="block news relative"
                        href="{{ focus|get_focus_url }}">
                                                {% if focus.content_category_title %}
@@ -26,7 +28,9 @@
                            {% for focus in news %}
                                    <li style="width:30%;" class="num-{{ forloop.counter }} padded">
                                            <button class="inBlock" data-about="#newsRollId-{{ focus.id }}">
                            {% for focus in news %}
                                    <li style="width:30%;" class="num-{{ forloop.counter }} padded">
                                            <button class="inBlock" data-about="#newsRollId-{{ focus.id }}">
-                                                   <img style="width:95%;" src="{{ focus.content_image|thumbnail:'160x120' }}" />
+                                                   {% thumbnail focus.content_image "160x120" crop="50% 25%" as im %}
+                                                   <img style="width:95%;" src="{{im.url}}" />
+                                                   {% endthumbnail %}
                                            </button>
                                    </li>
                            {% endfor %}
                                            </button>
                                    </li>
                            {% endfor %}
index ec68926cf09c9278599be84f588a7b4cc8d3d9f5..8af028e160ec56b4a4c2bbe087ed18fd461ef530 100644 (file)
@@ -1,10 +1,14 @@
-{% load paniktags thumbnails staticfiles %}
+{% load paniktags thumbnail staticfiles %}
 <div class="wrapper extra-soundfiles">
        <div class="logo">
                {% if soundfile.episode.image %}
 <div class="wrapper extra-soundfiles">
        <div class="logo">
                {% if soundfile.episode.image %}
-                       <img src="{{ soundfile.episode.image|thumbnail:'60x60' }}"/>
+                       {% thumbnail soundfile.episode.image "60x60" crop="50% 25%" as im %}
+                       <img width="60" height="60" src="{{im.url}}"/>
+                       {% endthumbnail %}
                {% elif soundfile.episode.emission.image %}
                {% elif soundfile.episode.emission.image %}
-                       <img src="{{ soundfile.episode.emission.image|thumbnail:'60x60' }}"/>
+                       {% thumbnail soundfile.episode.emission.image "60x60" crop="50% 25%" as im %}
+                       <img width="60" height="60" src="{{im.url}}"/>
+                       {% endthumbnail %}
                {% else %}
                        <img class="smooth"  style="width:60px;" src="{% static "img/emission.png" %}"/>
                {% endif %}
                {% else %}
                        <img class="smooth"  style="width:60px;" src="{% static "img/emission.png" %}"/>
                {% endif %}
index 04fd894a7c6b90cd1df87acfe2bf752e7c6a0a90..9701e39351b3ca2aef5b96f817b3cd0beba4e51a 100644 (file)
@@ -1,10 +1,14 @@
-{% load paniktags thumbnails staticfiles %}
+{% load paniktags thumbnail staticfiles %}
 <div class="wrapper extra-soundfiles">
        <div class="logo">
                {% if episode.image %}
 <div class="wrapper extra-soundfiles">
        <div class="logo">
                {% if episode.image %}
-                       <img src="{{ episode.image|thumbnail:'60x60' }}"/>
+                       {% thumbnail episode.image "60x60" crop="50% 25%" as im %}
+                       <img width="60" height="60" src="{{im.url}}"/>
+                       {% endthumbnail %}
                {% elif episode.emission.image %}
                {% elif episode.emission.image %}
-                       <img src="{{ episode.emission.image|thumbnail:'60x60' }}"/>
+                       {% thumbnail episode.emission.image "60x60" crop="50% 25%" as im %}
+                       <img width="60" height="60" src="{{im.url}}"/>
+                       {% endthumbnail %}
                {% else %}
                        <img class="smooth"  style="width:60px;" src="{% static "img/emission.png" %}"/>
                {% endif %}
                {% else %}
                        <img class="smooth"  style="width:60px;" src="{% static "img/emission.png" %}"/>
                {% endif %}
index ccfb42d6f0f3cc008897e97f48eb2743a7359b93..1e6083b9defec7574d5e270fee38cfe7b50056c3 100644 (file)
@@ -1,5 +1,5 @@
 {% extends "base.html" %}
 {% extends "base.html" %}
-{% load thumbnails paniktags %}
+{% load thumbnail paniktags %}
 {% block bodyID %}Party{% endblock %}
 {% block title %}Party{% endblock %}
 
 {% block bodyID %}Party{% endblock %}
 {% block title %}Party{% endblock %}
 
@@ -40,7 +40,9 @@ $(function() {
         </div>
       {% endif %}
       <div class="logo">
         </div>
       {% endif %}
       <div class="logo">
-        <img class="normal" src="{{ focus.content_image|thumbnail:'500x375' }}"/>
+        {% thumbnail focus.content_image "500x375" crop="50% 25%" as im %}
+        <img width="500" height="375" class="normal" src="{{im.url}}"/>
+        {% endthumbnail %}
       </div>
       <div class="title"><div>{{ focus.focus_title }}</div></div>
     </a>
       </div>
       <div class="title"><div>{{ focus.focus_title }}</div></div>
     </a>
index 1fb2e3f1c49a27e0ed16693c73a844f18f41f8d8..d6cde2cac3f6d2869fbfe5d2203d6b61a4df9c0d 100644 (file)
@@ -1,10 +1,14 @@
-{% load thumbnails paniktags staticfiles %}
+{% load thumbnail paniktags staticfiles %}
 <div class="episode soundfile inline cf">
        <div class="logo">
                {% if soundfile.episode.image %}
 <div class="episode soundfile inline cf">
        <div class="logo">
                {% if soundfile.episode.image %}
-                       <img width="60" height="60" src="{{ soundfile.episode.image|thumbnail:'60x60' }}"/>
+                       {% thumbnail soundfile.episode.image "60x60" crop="50% 25%" as im %}
+                       <img width="60" height="60" src="{{im.url}}"/>
+                       {% endthumbnail %}
                {% elif soundfile.episode.emission.image %}
                {% elif soundfile.episode.emission.image %}
-                       <img width="60" height="60" src="{{ soundfile.episode.emission.image|thumbnail:'60x60' }}"/>
+                       {% thumbnail soundfile.episode.emission.image "60x60" crop="50% 25%" as im %}
+                       <img width="60" height="60" src="{{im.url}}"/>
+                       {% endthumbnail %}
                {% else %}
                        <img width="60" height="60" src="{% static "img/sound.png" %}"/>
                {% endif %}
                {% else %}
                        <img width="60" height="60" src="{% static "img/sound.png" %}"/>
                {% endif %}
index 2def82dba26c5b32ae0ed13b7bf7a5d84646f6f5..51a67cbe9c7851dd9d7706127be7bf16d8232065 100644 (file)
@@ -5,3 +5,4 @@ django-debug-toolbar<1.0.0
 django-jquery
 django-taggit
 http://pypi.python.org/packages/source/d/django-jsonresponse/django-jsonresponse-0.5.tar.gz
 django-jquery
 django-taggit
 http://pypi.python.org/packages/source/d/django-jsonresponse/django-jsonresponse-0.5.tar.gz
+sorl-thumbnail
index 10c777d1781e22ec67c8276ed2c34fa3da794262..0db41f004a396efd0192b9e208aaca5c770d02cd 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -17,6 +17,7 @@ setup(name='panikweb',
           'django-jquery',
           'django-registration',
           'django-datetime-widget',
           'django-jquery',
           'django-registration',
           'django-datetime-widget',
+          'sorl-thumbnail',
            ],
       license='GPL',
       classifiers=['Development Status :: 3 - Alpha',
            ],
       license='GPL',
       classifiers=['Development Status :: 3 - Alpha',