2017-01-20 15:18:10 +00:00
|
|
|
from django import template
|
2020-02-01 04:09:20 +00:00
|
|
|
from django.templatetags.static import static
|
2017-01-20 15:18:10 +00:00
|
|
|
|
|
|
|
register = template.Library()
|
2019-06-16 12:32:24 +00:00
|
|
|
|
|
|
|
|
|
|
|
@register.inclusion_tag("thumbnail.html")
|
2017-01-20 15:18:10 +00:00
|
|
|
def thumbnail(path, filename, description):
|
|
|
|
"""
|
|
|
|
Returns the HTML to show an image including thumbnail.
|
|
|
|
Assumes the thumbnail is called 'thumbnail_foo.jpg.png' if the image is called 'foo.jpg'.
|
|
|
|
Path should be relative inside static root.
|
|
|
|
Description is used for alt-text and mouseover.
|
|
|
|
"""
|
2019-06-16 12:32:24 +00:00
|
|
|
return {"path": static("") + path, "filename": filename, "description": description}
|