File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change
1
+ import math
2
+
1
3
from collections import OrderedDict
2
4
from django import template
3
5
from django .conf import settings
@@ -69,3 +71,11 @@ def benefit_quantity_for_package(benefit, package):
69
71
@register .simple_tag
70
72
def benefit_name_for_display (benefit , package ):
71
73
return benefit .name_for_display (package = package )
74
+
75
+
76
+ @register .filter
77
+ def ideal_size (image , ideal_dimension ):
78
+ ideal_dimension = int (ideal_dimension )
79
+ return int (
80
+ image .width * math .sqrt ((100 * ideal_dimension ) / (image .width * image .height ))
81
+ )
Original file line number Diff line number Diff line change 1
1
{% load thumbnail %}
2
2
{% load cache %}
3
+ {% load sponsors %}
3
4
4
5
5
6
{% if logo_place == "download" %}
@@ -46,7 +47,7 @@ <h1 style="font-size: {% if forloop.first %}350%{% else %}300%{% endif %}">{{ pa
46
47
< div id ={{ sponsorship.sponsor.name|slugify }} >
47
48
< a href ="{{ sponsorship.sponsor.landing_page_url }} ">
48
49
{% thumbnail sponsorship.sponsor.web_logo thumbnail_res format="PNG" quality=100 as im %}
49
- < img src ="{{ im.url }} " alt ="{{ sponsorship.sponsor.name }} logo " style ="max-height:{{ im.height }}px;max- width:{{ im.width }}px;height:auto;width:auto; ">
50
+ < img src ="{{ im.url }} " alt ="{{ sponsorship.sponsor.name }} logo " style ="max-width:{{ im|ideal_size:dimension }}px;height:auto;width:auto; ">
50
51
{% endthumbnail %}
51
52
</ a >
52
53
You can’t perform that action at this time.
0 commit comments