<img src="{{ im.url }}"/>
<span>{% if image.title %}{{ image.title }}{% endif %}</span>
</div>
-<div>
+<div> {# extra opened <div> #}
{% endthumbnail %}
{% endif %}
{% thumbnail image.image "60x60" crop="50% 25%" as im %}
{% if image.title %} title="{{image.title}}" {% endif %}/></span>
{% endthumbnail %}
{% endthumbnail %}
+
+ {% if forloop.last %}
+ </div> {# close extra <div> #}
+ {% endif %}
{% endfor %}
</div>
-</div>
<script type="text/javascript">
$(function() {
var $gallery = $('#gallery-{{cell.id}}');