panoramas are special, so treat them accordingly
This commit is contained in:
parent
7ea5788388
commit
af50aef4b8
2 changed files with 11 additions and 3 deletions
10
nasg.py
10
nasg.py
|
@ -1167,7 +1167,15 @@ class WebImage(object):
|
||||||
def _intermediate_dimension(self, size, width, height, crop=False):
|
def _intermediate_dimension(self, size, width, height, crop=False):
|
||||||
""" Calculate intermediate resize dimension and return a tuple of width, height """
|
""" Calculate intermediate resize dimension and return a tuple of width, height """
|
||||||
size = int(size)
|
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):
|
or (width < height and crop):
|
||||||
w = size
|
w = size
|
||||||
h = int(float(size / width) * height)
|
h = int(float(size / width) * height)
|
||||||
|
|
|
@ -58,13 +58,13 @@ function maybe_redirect($uri) {
|
||||||
$redirects = array(
|
$redirects = array(
|
||||||
{% for (from, to) in redirects %}
|
{% for (from, to) in redirects %}
|
||||||
"{{ from }}" => "{{ to }}",
|
"{{ from }}" => "{{ to }}",
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
);
|
);
|
||||||
|
|
||||||
$gone = array(
|
$gone = array(
|
||||||
{% for gone in gones %}
|
{% for gone in gones %}
|
||||||
"{{ gone }}" => true,
|
"{{ gone }}" => true,
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
);
|
);
|
||||||
|
|
||||||
$uri = filter_var($_SERVER['REQUEST_URI'], FILTER_SANITIZE_URL);
|
$uri = filter_var($_SERVER['REQUEST_URI'], FILTER_SANITIZE_URL);
|
||||||
|
|
Loading…
Reference in a new issue