Add custom thumbnailer

This commit is contained in:
Raphael Michel
2018-03-20 09:33:15 +01:00
parent 840cee206a
commit e7458f3032
16 changed files with 158 additions and 25 deletions

View File

@@ -1,7 +1,7 @@
{% extends "pretixpresale/base.html" %}
{% load i18n %}
{% load staticfiles %}
{% load thumbnail %}
{% load thumb %}
{% load eventurl %}
{% load safelink %}
{% block thetitle %}
@@ -27,7 +27,7 @@
{% if event_logo %}
<a href="{% eventurl event "presale:event.index" cart_namespace=cart_namespace|default_if_none:"" %}"
title="{{ event.name }}">
<img src="{{ event_logo|thumbnail_url:'logo' }}" alt="{{ event.name }}" class="event-logo" />
<img src="{{ event_logo|thumb:'5000x120' }}" alt="{{ event.name }}" class="event-logo" />
</a>
{% else %}
<h1>

View File

@@ -3,7 +3,7 @@
{% load l10n %}
{% load eventurl %}
{% load money %}
{% load thumbnail %}
{% load thumb %}
{% load eventsignal %}
{% load rich_text %}
{% block title %}{% trans "Presale" %}{% endblock %}
@@ -225,7 +225,7 @@
data-title="{{ item.name|force_escape|force_escape }}"
{# Yes, double-escape to prevent XSS in lightbox #}
data-lightbox="{{ item.id }}">
<img src="{{ item.picture|thumbnail_url:'productlist' }}"
<img src="{{ item.picture.name|thumb:'60x60^' }}"
alt="{{ item.name }}"/>
</a>
{% endif %}
@@ -348,7 +348,7 @@
data-title="{{ item.name|force_escape|force_escape }}"
{# Yes, double-escape to prevent XSS in lightbox #}
data-lightbox="{{ item.id }}">
<img src="{{ item.picture|thumbnail_url:'productlist' }}"
<img src="{{ item.picture.name|thumb:'60x60^' }}"
alt="{{ item.name }}"/>
</a>
{% endif %}

View File

@@ -4,7 +4,7 @@
{% load money %}
{% load eventurl %}
{% load eventsignal %}
{% load thumbnail %}
{% load thumb %}
{% load rich_text %}
{% block title %}{% trans "Voucher redemption" %}{% endblock %}
@@ -42,7 +42,7 @@
data-title="{{ item.name|force_escape|force_escape }}"
{# Yes, double-escape to prevent XSS in lightbox #}
data-lightbox="{{ item.id }}">
<img src="{{ item.picture|thumbnail_url:'productlist' }}"
<img src="{{ item.picture|thumb:'60x60^' }}"
alt="{{ item.name }}"/>
</a>
{% endif %}
@@ -139,7 +139,7 @@
data-title="{{ item.name|force_escape|force_escape }}"
{# Yes, double-escape to prevent XSS in lightbox #}
data-lightbox="{{ item.id }}">
<img src="{{ item.picture|thumbnail_url:'productlist' }}"
<img src="{{ item.picture|thumb:'60x60^' }}"
alt="{{ item.name }}"/>
</a>
{% endif %}

View File

@@ -1,5 +1,5 @@
{% extends "pretixpresale/event/base.html" %}
{% load i18n eventurl thumbnail bootstrap3 %}
{% load i18n eventurl bootstrap3 %}
{% block title %}{% trans "Waiting list" %}{% endblock %}
{% block content %}
<h2>{% trans "Add me to the waiting list" %}</h2>

View File

@@ -1,7 +1,7 @@
{% extends "pretixpresale/base.html" %}
{% load i18n %}
{% load staticfiles %}
{% load thumbnail %}
{% load thumb %}
{% load eventurl %}
{% block thetitle %}
{% block title %}{% endblock %}{% if url_name != "organizer.index" %} :: {% endif %}{{ organizer.name }}
@@ -11,7 +11,8 @@
<div class="pull-left">
{% if organizer_logo %}
<a href="{% eventurl organizer "presale:organizer.index" %}" title="{{ organizer.name }}">
<img src="{{ organizer_logo|thumbnail_url:'logo' }}" alt="{{ organizer.name }}" class="organizer-logo" />
<img src="{{ organizer_logo|thumb:'5000x120' }}" alt="{{ organizer.name }}"
class="organizer-logo" />
</a>
{% else %}
<h1><a href="{% eventurl organizer "presale:organizer.index" %}">{{ organizer.name }}</a></h1>

View File

@@ -1,6 +1,5 @@
import hashlib
import json
from urllib.parse import urljoin
from django.conf import settings
from django.contrib.staticfiles import finders
@@ -19,7 +18,6 @@ from django.views.decorators.http import condition
from django.views.i18n import (
get_formats, get_javascript_catalog, js_catalog_template,
)
from easy_thumbnails.files import get_thumbnailer
from lxml import etree
from pretix.base.i18n import language
@@ -27,6 +25,7 @@ from pretix.base.models import CartPosition, Voucher
from pretix.base.services.cart import error_messages
from pretix.base.settings import GlobalSettingsObject
from pretix.base.templatetags.rich_text import rich_text
from pretix.helpers.thumb import get_thumbnail
from pretix.presale.views.cart import get_or_create_cart_id
from pretix.presale.views.event import (
get_grouped_items, item_group_by_category,
@@ -136,8 +135,7 @@ def price_dict(price):
def get_picture(picture):
thumb = get_thumbnailer(picture)['productlist']
return urljoin(settings.SITE_URL, thumb.url)
return get_thumbnail(picture.name, '60x60^').thumb.url
class WidgetAPIProductList(View):