62 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			62 lines
		
	
	
	
		
			1.8 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| {% set thumbnails =
 | |
|     {
 | |
|         "audio": "audio",
 | |
|         "txt": "txt",
 | |
|         "svg": "svg",
 | |
|         "video": "video",
 | |
| 
 | |
|         "7z": "archive",
 | |
|         "gz": "archive",
 | |
|         "rar": "archive",
 | |
|         "tar": "archive",
 | |
|         "zip": "archive",
 | |
|     }
 | |
| %}
 | |
| {% macro create_photo_card(photo, view="grid") %}
 | |
| 
 | |
| {% if view == "list" %}
 | |
| <div class="photo_card_list">
 | |
|     <a target="_blank" href="/photo/{{photo["id"]}}">{{photo["filename"]}}</a>
 | |
| </div>
 | |
| 
 | |
| {% else %}
 | |
| <div class="photo_card_grid">
 | |
|     <div class="photo_card_grid_thumb">
 | |
|         <a target="_blank" href="/photo/{{photo["id"]}}">
 | |
|             <img height="150"
 | |
|             {% if photo["has_thumbnail"] %}
 | |
|                 src="/thumbnail/{{photo["id"]}}.jpg"
 | |
|             {% else %}
 | |
|                 {% set choice =
 | |
|                     thumbnails.get(photo["extension"],
 | |
|                     thumbnails.get(photo["mimetype"],
 | |
|                     'other'))
 | |
|                 %}
 | |
|                 src="/static/basic_thumbnails/{{choice}}.png"
 | |
|             {% endif %}
 | |
|         </a>
 | |
|     </div>
 | |
|     <div class="photo_card_grid_info">
 | |
|         <a target="_blank" href="/photo/{{photo["id"]}}">{{photo["filename"]}}</a>
 | |
|         <span class="photo_card_grid_file_metadata">
 | |
|         {% if photo["width"] %}
 | |
|             {{photo["width"]}}x{{photo["height"]}},
 | |
|         {% endif %}
 | |
|         {% if photo["duration"] %}
 | |
|             {{photo["duration_str"]}},
 | |
|         {% endif %}
 | |
|         {{photo["bytes_str"]}}
 | |
|         </span>
 | |
|         <span class="photo_card_grid_tags">
 | |
|             {% if photo["tags"] %}
 | |
|             {% set tags=[] %}
 | |
|             {% for tag in photo["tags"] %}
 | |
|             {% do tags.append(tag["name"]) %}
 | |
|             {% endfor %}
 | |
|             <span title="{{", ".join(tags)}}">T</span>
 | |
|             {% endif %}
 | |
|         </span>
 | |
|     </div>
 | |
| </div>
 | |
| {% endif %}
 | |
| {% endmacro %}
 |