summaryrefslogtreecommitdiff
path: root/src/generators.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/generators.c')
-rw-r--r--src/generators.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/generators.c b/src/generators.c
index f0ba940..cf32819 100644
--- a/src/generators.c
+++ b/src/generators.c
@@ -171,11 +171,17 @@ generate_image (TGallerySetup *setup,
*thumb_portrait = (thumb_w / thumb_h) < 1;
if ((thumb_w > 0) && (thumb_h > 0)) {
+ /* Squared thumbnails */
+ if (setup->squared_thumbnail_type != THUMBNAIL_SQUARE_TYPE_NONE) {
+ thumb_w = setup->thumbnail_square_size;
+ thumb_h = setup->thumbnail_square_size;
+ } else
+ /* Portrait / Landscape thumbnails */
if (! *thumb_portrait)
calculate_sizes (setup->thumbnail_landscape_width, setup->thumbnail_landscape_height, &thumb_w, &thumb_h);
else
calculate_sizes (setup->thumbnail_portrait_width, setup->thumbnail_portrait_height, &thumb_w, &thumb_h);
- if (! resize_image (thumb_src_full, thumb_dst, thumb_w, thumb_h, setup->thumbnail_quality, TRUE))
+ if (! resize_image (thumb_src_full, thumb_dst, thumb_w, thumb_h, setup->thumbnail_quality, TRUE, setup->squared_thumbnail_type))
log_error ("generate_image: error resizing thumbnail %s\n", thumb_src_full);
} else
log_error ("generate_image: thumbnail %s sizes are %lux%lu\n", thumb_src_full, thumb_w, thumb_h);
@@ -208,7 +214,7 @@ generate_image (TGallerySetup *setup,
}
g_assert (img_src_full != NULL);
- if (! resize_image (img_src_full, big_dst, new_w, new_h, bigq, FALSE))
+ if (! resize_image (img_src_full, big_dst, new_w, new_h, bigq, FALSE, 0))
log_error ("generate_image: error resizing big image %s\n", img_src_full);
}
else
@@ -413,6 +419,7 @@ write_html_album (TGallerySetup *setup,
block_parser_register_key (block_parser, "IMG_LIST", "IMG_LIST");
block_parser_register_key (block_parser, "IMG_LIST_LANDSCAPE", NULL);
block_parser_register_key (block_parser, "IMG_LIST_PORTRAIT", NULL);
+ block_parser_register_key (block_parser, "IMG_LIST_SQUARED", NULL);
block_parser_register_key (block_parser, "LIST_SEPARATOR", NULL);
block_parser_register_key (block_parser, "LIST_INTERSPACE", NULL);
block_parser_register_key (block_parser, "GO_UP", "GO_UP");
@@ -454,7 +461,11 @@ write_html_album (TGallerySetup *setup,
case INDEX_ITEM_TYPE_PICTURE:
/* Skip HTML code generation if it's a hidden item */
if (! item->hidden) {
- s1 = block_parser_get_data (block_parser, item->gen_portrait ? "IMG_LIST_PORTRAIT" : "IMG_LIST_LANDSCAPE");
+ if (setup->squared_thumbnail_type != THUMBNAIL_SQUARE_TYPE_NONE)
+ s1 = "IMG_LIST_SQUARED";
+ else
+ s1 = item->gen_portrait ? "IMG_LIST_PORTRAIT" : "IMG_LIST_LANDSCAPE";
+ s1 = block_parser_get_data (block_parser, s1);
replace_table_add_key_printf (local_replace_table, "ALBUM_SUBPATH", "%s/%s", item->path, setup->index_file_name);
s3 = item_get_img_src (setup, items, item);
replace_table_add_key_printf (local_replace_table, "IMG_SUBPAGE", "%s%s", s3, GET_EXT (setup->index_file_name));