diff --git a/inc/template.php b/inc/template.php index 48b2b1bb..b0d7bfb2 100644 --- a/inc/template.php +++ b/inc/template.php @@ -29,6 +29,9 @@ function load_twig() { )); $twig->addExtension(new Twig_Extensions_Extension_Tinyboard()); $twig->addExtension(new Twig_Extensions_Extension_I18n()); + + $twig->addFilter(new Twig_SimpleFilter('hex2bin', 'hex2bin')); + $twig->addFilter(new Twig_SimpleFilter('base64_encode', 'base64_encode')); } function Element($templateFile, array $options) { diff --git a/templates/post/image.html b/templates/post/image.html index 818ccb57..9b5449ad 100644 --- a/templates/post/image.html +++ b/templates/post/image.html @@ -21,6 +21,7 @@ {% endif %} " style="width:{{ post.thumbwidth }}px;height:{{ post.thumbheight }}px" + data-md5="{{ post.hash|hex2bin|base64_encode }}" > {% else %} @@ -40,6 +41,7 @@ {% endif %} " style="width:{{ post.thumbwidth }}px;height:{{ post.thumbheight }}px" alt="" + data-md5="{{ post.hash|hex2bin|base64_encode }}" /> {% endif %}