diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2009-02-17 21:22:40 +0100 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2009-02-17 21:22:40 +0100 |
| commit | 48cb3b4f0d0598b1a84958785323978f4dfee67c (patch) | |
| tree | 8a018df0eea12e9a11af576153eec827f8dd7e17 /generators.c | |
| parent | 4dc6bd21043a4ce31638e239b7c8b7a2e626e6e6 (diff) | |
| download | cataract-48cb3b4f0d0598b1a84958785323978f4dfee67c.tar.xz | |
Allow foreign image paths
Diffstat (limited to 'generators.c')
| -rw-r--r-- | generators.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/generators.c b/generators.c index 2c7b7a0..c6df9c0 100644 --- a/generators.c +++ b/generators.c @@ -667,10 +667,13 @@ write_html_image (TGallerySetup *setup, next_item = NULL; /* Paths setup */ + imgname = g_path_get_basename ((item->path == NULL && item->preview) ? item->preview : item->path); + if (next_item && setup->preload) { + s1 = g_path_get_basename ((next_item->path == NULL && next_item->preview) ? next_item->preview : next_item->path); + preload_imgname = g_strconcat (IMG_BIG_DIR, "/", s1, NULL); + g_free (s1); + } s1 = g_path_get_dirname (dst); - imgname = (item->path == NULL && item->preview) ? g_path_get_basename (item->preview) : g_strdup (item->path); - if (next_item && setup->preload) - preload_imgname = g_strconcat (IMG_BIG_DIR, "/", (next_item->path == NULL && next_item->preview) ? g_path_get_basename (next_item->preview) : g_strdup (next_item->path), NULL); big_dst = g_strconcat (s1, "/", IMG_BIG_DIR, "/", imgname, NULL); orig_dst = g_strconcat (s1, "/", IMG_ORIG_DIR, "/", imgname, NULL); g_free (s1); @@ -911,7 +914,7 @@ write_html_image (TGallerySetup *setup, if (strstr (b, "<!-- $(LINK_NEXT) -->")) { if (next_item) { - s2 = (next_item->path == NULL && next_item->preview) ? g_path_get_basename (next_item->preview) : g_strdup (next_item->path); + s2 = g_path_get_basename ((next_item->path == NULL && next_item->preview) ? next_item->preview : next_item->path); s1 = g_strconcat (s2, ".html", NULL); str_replace (&b, "<!-- $(LINK_NEXT) -->", s1, NULL); g_free (s1); @@ -922,7 +925,7 @@ write_html_image (TGallerySetup *setup, } if (strstr(b, "<!-- $(LINK_PREV) -->")) { if (previous_item) { - s2 = (previous_item->path == NULL && previous_item->preview) ? g_path_get_basename (previous_item->preview) : g_strdup (previous_item->path); + s2 = g_path_get_basename ((previous_item->path == NULL && previous_item->preview) ? previous_item->preview : previous_item->path); s1 = g_strconcat (s2, ".html", NULL); str_replace (&b, "<!-- $(LINK_PREV) -->", s1, NULL); g_free (s1); @@ -1164,7 +1167,7 @@ build_tree (TGallerySetup *setup, continue; } if (item->type == INDEX_ITEM_TYPE_PICTURE) { - imgname = (item->path == NULL && item->preview) ? g_path_get_basename (item->preview) : g_strdup (item->path); + imgname = g_path_get_basename ((item->path == NULL && item->preview) ? item->preview : item->path); if (setup->verbose) printf ("Writing '%s.html' ...", imgname); s1 = g_strconcat (setup->real_templates_dir, "/", setup->template_photo, NULL); s2 = g_strconcat (items->base_dir, "/", (item->path == NULL && item->preview) ? item->preview : item->path, NULL); |
