panoramas are special, so treat them accordingly

This commit is contained in:
Peter Molnar 2018-06-13 08:27:23 +00:00
parent 7ea5788388
commit af50aef4b8
2 changed files with 11 additions and 3 deletions

10
nasg.py
View file

@ -1167,7 +1167,15 @@ class WebImage(object):
def _intermediate_dimension(self, size, width, height, crop=False):
""" Calculate intermediate resize dimension and return a tuple of width, height """
size = int(size)
if (width > height and not crop) \
if (width > height*3):
size = int(size * 0.6)
# panorama
if (height <= size):
h = height
else:
h = size
w = int(float(h / height) * width)
elif (width > height and not crop) \
or (width < height and crop):
w = size
h = int(float(size / width) * height)

View file

@ -58,13 +58,13 @@ function maybe_redirect($uri) {
$redirects = array(
{% for (from, to) in redirects %}
"{{ from }}" => "{{ to }}",
{% endfor %}
{%- endfor %}
);
$gone = array(
{% for gone in gones %}
"{{ gone }}" => true,
{% endfor %}
{%- endfor %}
);
$uri = filter_var($_SERVER['REQUEST_URI'], FILTER_SANITIZE_URL);