[enh] yay, handle thumbnails in pictures-group
This commit is contained in:
parent
89399375a4
commit
09c2f2570b
10
prosopopoee
10
prosopopoee
@ -22,6 +22,16 @@ class TemplateFunctions():
|
|||||||
print os.path.join(self.base_dir, image), "->", os.path.join(self.target_dir, image)
|
print os.path.join(self.base_dir, image), "->", os.path.join(self.target_dir, image)
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
def generate_thumbnail(self, image, gm_geometry):
|
||||||
|
thumbnail_name = image.split(".")
|
||||||
|
thumbnail_name[-2] += "-small"
|
||||||
|
thumbnail_name = ".".join(thumbnail_name)
|
||||||
|
|
||||||
|
command = "gm convert %s -resize %s %s" % (os.path.join(self.base_dir, image), gm_geometry, os.path.join(self.target_dir, thumbnail_name))
|
||||||
|
print command
|
||||||
|
os.system(command)
|
||||||
|
return thumbnail_name
|
||||||
|
|
||||||
|
|
||||||
def error(test, error_message):
|
def error(test, error_message):
|
||||||
if test:
|
if test:
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
{{ helpers.copy_image(image) }}
|
{{ helpers.copy_image(image) }}
|
||||||
<div class="picture">
|
<div class="picture">
|
||||||
<a href="{{ image }}">
|
<a href="{{ image }}">
|
||||||
<img src="{{ image }}">
|
<img src="{{ helpers.generate_thumbnail(image, "x400") }}">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
{% if not loop.last %}
|
{% if not loop.last %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user