<ul class="thumbnails">

{% for pic in gallery_pictures %}
{% with pic.get_caption as caption %}
<li class="{{ thumb_size }}">
<a class="gallery-image" rel="gallery-{{ gallery_id}}" href="{{ pic.resized.url }}"
    {% if caption %} title="{{ caption }}" {% endif %}>
    <img class="thumbnail" src="{{ pic.thumbnail.url }}" alt="{{ caption }}" />
  </a>
</li>
{% endwith %}
{% endfor %}
</script>

</ul>
