summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Bzatek <tbzatek@users.sourceforge.net>2009-02-14 21:21:49 +0100
committerTomas Bzatek <tbzatek@users.sourceforge.net>2009-02-14 21:21:49 +0100
commit4dc6bd21043a4ce31638e239b7c8b7a2e626e6e6 (patch)
tree27947c8f4412659f48d0e4f0892536af56dd1d8c
parentc0d9426f47bba44a75a46bf6cf3194e613d92aeb (diff)
downloadcataract-4dc6bd21043a4ce31638e239b7c8b7a2e626e6e6.tar.xz
Support for global <nofullsize> tag
-rw-r--r--generators.c6
-rw-r--r--items.c8
-rw-r--r--items.h4
3 files changed, 13 insertions, 5 deletions
diff --git a/generators.c b/generators.c
index 170c283..2c7b7a0 100644
--- a/generators.c
+++ b/generators.c
@@ -166,7 +166,7 @@ generate_image (TGallerySetup *setup,
modify_exif (big_dst, setup->erase_exif_thumbnail, setup->add_copyright);
g_free (big_dst);
- if (! item->nofullsize)
+ if (item->force_fullsize || (! item->force_nofullsize && ! items->nofullsize))
{
s1 = g_path_get_dirname(dst);
orig_dst = g_strconcat (s1, "/", IMG_ORIG_DIR, "/", *img_src, NULL);
@@ -685,7 +685,7 @@ write_html_image (TGallerySetup *setup,
/* Retrieve image sizes of preview and original image */
get_image_sizes (big_dst, &img_big_w, &img_big_h);
- if (! item->nofullsize)
+ if (item->force_fullsize || (! item->force_nofullsize && ! parent_items->nofullsize))
get_image_sizes (orig_dst, &img_orig_w, &img_orig_h);
@@ -706,7 +706,7 @@ write_html_image (TGallerySetup *setup,
if (strstr (buffer, "<!-- $(END_IMG_FULLSIZE_LINK) -->")) {
in_img_fullsize_link = FALSE;
free (b);
- if (! item->nofullsize)
+ if (item->force_fullsize || (! item->force_nofullsize && ! parent_items->nofullsize))
b = strdup (buf_img_fullsize_link);
else continue;
}
diff --git a/items.c b/items.c
index 413630f..5e4bf4a 100644
--- a/items.c
+++ b/items.c
@@ -87,6 +87,8 @@ parse_album_xml (const char *filename, TAlbum *index)
index->meta_description = xml_file_get_node_value (xml, "/gallery/general/meta/description/text()");
index->meta_keywords = xml_file_get_node_value (xml, "/gallery/general/meta/keywords/text()");
+ index->nofullsize = xml_file_get_node_present (xml, "/gallery/general/nofullsize");
+
/* Section Items */
count = xml_file_node_get_children_count (xml, "/gallery/items/*");
#ifdef __DEBUG_ALL__
@@ -136,7 +138,11 @@ parse_album_xml (const char *filename, TAlbum *index)
}
s = g_strdup_printf ("/gallery/items/*[%d]/nofullsize", i + 1);
- item->nofullsize = (xml_file_get_node_present (xml, s) || item->path == NULL);
+ item->force_nofullsize = (xml_file_get_node_present (xml, s) || item->path == NULL);
+ g_free (s);
+
+ s = g_strdup_printf ("/gallery/items/*[%d]/fullsize", i + 1);
+ item->force_fullsize = (xml_file_get_node_present (xml, s) || item->path == NULL);
g_free (s);
s = g_strdup_printf ("/gallery/items/*[%d]/hidden", i + 1);
diff --git a/items.h b/items.h
index 810f758..8bb7502 100644
--- a/items.h
+++ b/items.h
@@ -51,6 +51,7 @@ typedef struct {
char *meta_author;
char *meta_description;
char *meta_keywords;
+ gboolean nofullsize;
} TAlbum;
typedef struct {
@@ -62,7 +63,8 @@ typedef struct {
int quality;
unsigned long width;
unsigned long height;
- gboolean nofullsize;
+ gboolean force_nofullsize;
+ gboolean force_fullsize;
char *border_style;
TIndexItemType type;
gboolean hidden;