{% macro format(thumbnail, b_w, b_h, extraclass)%} {% set b_width = b_w %} {% set b_height = b_h|default(b_w) %} {% set b_ratio = b_width / b_height %} {% set thumbnail_height = thumbnail.get_height() > 0 ? thumbnail.get_height() : 120 %} {% set thumbnail_width = thumbnail.get_width() > 0 ? thumbnail.get_width() : 120 %} {% set i_ratio = thumbnail_width / thumbnail_height %} {% if i_ratio > b_ratio%} {% if b_width > thumbnail_width %} {% set d_width = thumbnail_width %} {% else %} {% set d_width = b_width %} {% endif %} {% set d_height = d_width / thumbnail_width * thumbnail_height %} {% set top = (b_height - d_height) / 2 %} {% else %} {% if b_height > thumbnail_height %} {% set d_height = thumbnail_height %} {% else %} {% set d_height = b_height %} {% endif %} {% set d_width = d_height * thumbnail_width / thumbnail_height %} {% set top = ((b_height - d_height) / 2) %} {% endif %} {% set url = app.getAuthenticator().isAuthenticated() ? thumbnail.get_url() : thumbnail.get_permalink().get_url() %} {% set record_type = thumbnail.get_type() %}
{% if record_type == 'VIDEO_MP4' or record_type == 'VIDEO_FLV' %} {% elseif record_type == 'FLEXPAPER' %} {% elseif record_type == 'AUDIO_MP3' %} {% else %} {% endif %}
{% endmacro %} {% macro format100percent(thumbnail, extraclass)%} {% set url = app.getAuthenticator().isAuthenticated() ? thumbnail.get_url() : thumbnail.get_permalink().get_url() %} {% set record_type = thumbnail.get_type() %} {% if record_type == 'VIDEO_MP4' or record_type == 'VIDEO_FLV' %} {% set thumbnail_height = thumbnail.get_height() > 0 ? thumbnail.get_height() : 120 %} {% set thumbnail_width = thumbnail.get_width() > 0 ? thumbnail.get_width() : 120 %} {% elseif record_type == 'FLEXPAPER' %} {% elseif record_type == 'AUDIO_MP3' %} {% elseif record_type == 'PDF' %} {% else %} {% endif %} {% endmacro %}