diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/photos/templatetags/get_image_width.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/photos/templatetags/get_image_width.py b/app/photos/templatetags/get_image_width.py new file mode 100644 index 0000000..ac39184 --- /dev/null +++ b/app/photos/templatetags/get_image_width.py @@ -0,0 +1,9 @@ +from math import floor +from django import template + +register = template.Library() + +@register.simple_tag +def get_image_width(obj, size, *args): + ratio = floor(int(size)*100/int(obj.height))/100 + return floor(ratio*int(obj.height)) |