aboutsummaryrefslogtreecommitdiffstats
path: root/www/swiggle/files/patch-html.c
blob: 2a0a8bfbdc264fa5b49b4ff157ca042c1196f34f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
--- html.c.orig Sat Oct 23 22:57:02 2004
+++ html.c  Wed Nov  1 15:45:01 2006
@@ -50,6 +50,7 @@
 #define    MAX_PER_PAGE    (cols*rows)
 
 extern int cols;
+extern int exif_display;
 extern int rows;
 extern char    generated[];
 extern char    *albumdesc;
@@ -115,37 +116,66 @@
            imglist[x].width,
            imglist[x].height,
            (int) (imglist[x].filesize/1024));
-       
-       fprintf(html, "<table width=\"100%%\" border=\"1\">\n");
-       
-       if (imglist[x].datetime != NULL) {
-           fprintf(html, "<tr>\n<td><small>Taken:</small></td>"
-               "<td><small>%s</small></td>\n</tr>\n",
-               imglist[x].datetime);
-       }
-       if (imglist[x].aperture != NULL) {
-           fprintf(html, "<tr>\n<td><small>Aperture:</small></td>"
-               "<td><small>%s</small></td>\n</tr>\n",
-               imglist[x].aperture);
-       }
-       if (imglist[x].exposuretime != NULL) {
-           fprintf(html, "<tr>\n<td><small>Exposure Time</small>:"
-               "</td><td><small>%s</small></td>\n</tr>\n",
-               imglist[x].exposuretime);
-       }
-       if (imglist[x].flash != NULL) {
-           fprintf(html, "<tr>\n<td><small>Flash:</small></td>"
-               "<td><small>%s</small></td>\n</tr>\n",
-               imglist[x].flash);
-       }
-       if (imglist[x].model != NULL) {
-           fprintf(html, "<tr>\n<td><small>Model:</small></td>"
-               "<td><small>%s</small></td>\n</tr>\n",
-               imglist[x].model);
+
+       /* Display by default */
+       if (exif_display == 1) {
+           fprintf(html, "<table width=\"100%%\" border=\"1\">\n");
+
+           if (imglist[x].datetime != NULL) {
+               fprintf(html, "<tr>\n<td><small>Taken:</small></td>"
+                   "<td><small>%s</small></td>\n</tr>\n",
+                   imglist[x].datetime);
+           }
+           if (imglist[x].aperture != NULL) {
+               fprintf(html, "<tr>\n<td><small>Aperture:</small></td>"
+                   "<td><small>%s</small></td>\n</tr>\n",
+                   imglist[x].aperture);
+           }
+           if (imglist[x].exposuretime != NULL) {
+               fprintf(html, "<tr>\n<td><small>Exposure Time:</small>"
+                   "</td><td><small>%s</small></td>\n</tr>\n",
+                   imglist[x].exposuretime);
+           }
+           if (imglist[x].flash != NULL) {
+               fprintf(html, "<tr>\n<td><small>Flash:</small></td>"
+                   "<td><small>%s</small></td>\n</tr>\n",
+                   imglist[x].flash);
+           }
+           if (imglist[x].model != NULL) {
+               fprintf(html, "<tr>\n<td><small>Model:</small></td>"
+                   "<td><small>%s</small></td>\n</tr>\n",
+                   imglist[x].model);
+           }
+
+           fprintf(html, "</table>\n<p>\n<small>\n");
+       /* Hide in comments if user requests */
+       } else if (exif_display == 2) {
+           fprintf(html, "<!-- Begin EXIF data\n");
+
+           if (imglist[x].datetime != NULL) {
+               fprintf(html, "Taken: %s\n",
+                   imglist[x].datetime);
+           }
+           if (imglist[x].aperture != NULL) {
+               fprintf(html, "Aperture: %s\n",
+                   imglist[x].aperture);
+           }
+           if (imglist[x].exposuretime != NULL) {
+               fprintf(html, "Exposure Time: %s\n",
+                   imglist[x].exposuretime);
+           }
+           if (imglist[x].flash != NULL) {
+               fprintf(html, "Flash: %s\n",
+                   imglist[x].flash);
+           }
+           if (imglist[x].model != NULL) {
+               fprintf(html, "Model: %s\n",
+                   imglist[x].model);
+           }
+
+           fprintf(html, "End EXIF data -->\n");
        }
        
-       fprintf(html, "</table>\n<p>\n<small>\n");
-       
        if (offset == 1) {
            fprintf(html, "<a href=\"index.html\">"
                "Back to thumbnails</a>\n");
@@ -197,7 +227,7 @@
  * Returns the number of thumbnail index pages created.
  */
 int 
-create_thumbindex(char *dir, struct imginfo *imglist, int imgcount)
+create_thumbindex(char *dir, struct imginfo *imglist, int imgcount, int show_descr)
 {
    char *desc, final[MAXPATHLEN], tmp[MAXPATHLEN];
    int pages, offset, x, y;
@@ -277,21 +307,33 @@
        while (x < y) {
            if (x % cols == 0)
                fprintf(html, "<tr>\n");
-           
-           fprintf(html, "<td align=\"center\">\n"
-               "<a href=\"%s.html\"><img src=\".thumbs/%s\" "
-               "border=\"0\" alt=\"%s\" width=\"%d\" "
-               "height=\"%d\"></a><br>\n<small>%d x %d, %d KB"
-               "</small>\n<br><br>\n</td>\n", 
-               imglist[x].filename, 
-               imglist[x].filename, 
-               imglist[x].filename, 
-               imglist[x].thumbwidth, 
-               imglist[x].thumbheight,
-               imglist[x].width,
-               imglist[x].height,
-               (int)(imglist[x].filesize / 1024));
-           
+           if (show_descr) {
+               fprintf(html, "<td align=\"center\">\n"
+                   "<a href=\"%s.html\"><img src=\".thumbs/%s\" "
+                   "border=\"0\" alt=\"%s\" width=\"%d\" "
+                   "height=\"%d\"></a><br>\n<small>%s"
+                   "</small>\n<br><br>\n</td>\n", 
+                   imglist[x].filename, 
+                   imglist[x].filename, 
+                   imglist[x].filename, 
+                   imglist[x].thumbwidth, 
+                   imglist[x].thumbheight,
+                   imglist[x].description);
+           } else {
+               fprintf(html, "<td align=\"center\">\n"
+                   "<a href=\"%s.html\"><img src=\".thumbs/%s\" "
+                   "border=\"0\" alt=\"%s\" width=\"%d\" "
+                   "height=\"%d\"></a><br>\n<small>%d x %d, %d KB"
+                   "</small>\n<br><br>\n</td>\n", 
+                   imglist[x].filename, 
+                   imglist[x].filename, 
+                   imglist[x].filename, 
+                   imglist[x].thumbwidth, 
+                   imglist[x].thumbheight,
+                   imglist[x].width,
+                   imglist[x].height,
+                   (int)(imglist[x].filesize / 1024));
+           }   
            if ((x % cols == cols - 1) || (x + 1 == imgcount))
                fprintf(html, "</tr>\n");