From 6a7b5cbbef56fda6c1f3901949b870ee1fd20758 Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Tue, 30 Dec 2008 12:48:19 +0100 Subject: Make thumbnail file names unique --- generators.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'generators.c') diff --git a/generators.c b/generators.c index f2aaa31..5eb7fde 100644 --- a/generators.c +++ b/generators.c @@ -39,6 +39,7 @@ void generate_image (TGallerySetup *setup, TAlbum *items, TIndexItem *item, + unsigned int item_index, const char *dst, unsigned long *img_w, unsigned long *img_h, char **img_src, char **thumb) @@ -66,7 +67,9 @@ generate_image (TGallerySetup *setup, img_src_full = g_strconcat (items->base_dir, "/", item->thumbnail, NULL); thumb_src_full = g_strconcat (items->base_dir, "/", item->thumbnail, NULL); *img_src = g_path_get_basename (item->thumbnail); - *thumb = g_path_get_basename (item->thumbnail); + s1 = g_path_get_basename (item->thumbnail); + *thumb = g_strdup_printf ("thn_%.3d_%s", item_index, s1); + g_free (s1); } else if (items->type == GALLERY_TYPE_ALBUM) { @@ -75,7 +78,9 @@ generate_image (TGallerySetup *setup, img_src_full = g_strconcat (items->base_dir, "/", *img_src, NULL); thumb_src_full = g_strconcat (items->base_dir, "/", *thumb, NULL); *img_src = g_path_get_basename (*img_src); - *thumb = g_path_get_basename (*thumb); + s1 = g_path_get_basename (*thumb); + *thumb = g_strdup_printf ("thn_%.3d_%s", item_index, s1); + g_free (s1); } get_image_sizes (img_src_full, img_w, img_h); @@ -446,7 +451,7 @@ write_html_album (TGallerySetup *setup, switch (item->type) { case INDEX_ITEM_TYPE_PICTURE: - generate_image (setup, items, item, dst, &img_w, &img_h, &img_src, &thumb); + generate_image (setup, items, item, i, dst, &img_w, &img_h, &img_src, &thumb); /* Skip HTML code generation if it's a hidden item */ if (! item->hidden) { if (img_w == 0 || img_h == 0 || (img_w / img_h) >= 1) -- cgit v1.2.3