summarylogtreecommitdiffstats
path: root/minidlna-custom-icon.patch
blob: efe5428282443e956b1cc3906de8047c1f6159f7 (plain)
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
diff --git a/icons.c b/icons.c
index 0161a2c..6beda67 100644
--- a/icons.c
+++ b/icons.c
@@ -21,7 +21,7 @@
 #ifdef NETGEAR
 /* NG_Icon_48x48.png */
 unsigned char
-png_sm[] =   "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x30\x00\x00\x00\x30"
+_png_sm[] =   "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x30\x00\x00\x00\x30"
              "\x08\x06\x00\x00\x00\x57\x02\xf9\x87\x00\x00\x00\x19\x74\x45\x58\x74\x53\x6f\x66\x74\x77\x61\x72"
              "\x65\x00\x41\x64\x6f\x62\x65\x20\x49\x6d\x61\x67\x65\x52\x65\x61\x64\x79\x71\xc9\x65\x3c\x00\x00"
              "\x03\x22\x69\x54\x58\x74\x58\x4d\x4c\x3a\x63\x6f\x6d\x2e\x61\x64\x6f\x62\x65\x2e\x78\x6d\x70\x00"
@@ -138,7 +138,7 @@ png_sm[] =   "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x
 
 /* NG_Icon_120x120.png */
 unsigned char
-png_lrg[] =  "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x78\x00\x00\x00\x78"
+_png_lrg[] =  "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x78\x00\x00\x00\x78"
              "\x08\x06\x00\x00\x00\x39\x64\x36\xd2\x00\x00\x00\x19\x74\x45\x58\x74\x53\x6f\x66\x74\x77\x61\x72"
              "\x65\x00\x41\x64\x6f\x62\x65\x20\x49\x6d\x61\x67\x65\x52\x65\x61\x64\x79\x71\xc9\x65\x3c\x00\x00"
              "\x03\x22\x69\x54\x58\x74\x58\x4d\x4c\x3a\x63\x6f\x6d\x2e\x61\x64\x6f\x62\x65\x2e\x78\x6d\x70\x00"
@@ -355,7 +355,7 @@ png_lrg[] =  "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x
 
 /* NG_Icon_48x48.jpg */
 unsigned char
-jpeg_sm[] =  "\xff\xd8\xff\xe1\x00\x18\x45\x78\x69\x66\x00\x00\x49\x49\x2a\x00\x08\x00\x00\x00\x00\x00\x00\x00"
+_jpeg_sm[] =  "\xff\xd8\xff\xe1\x00\x18\x45\x78\x69\x66\x00\x00\x49\x49\x2a\x00\x08\x00\x00\x00\x00\x00\x00\x00"
              "\x00\x00\x00\x00\xff\xec\x00\x11\x44\x75\x63\x6b\x79\x00\x01\x00\x04\x00\x00\x00\x64\x00\x00\xff"
              "\xe1\x03\x2b\x68\x74\x74\x70\x3a\x2f\x2f\x6e\x73\x2e\x61\x64\x6f\x62\x65\x2e\x63\x6f\x6d\x2f\x78"
              "\x61\x70\x2f\x31\x2e\x30\x2f\x00\x3c\x3f\x78\x70\x61\x63\x6b\x65\x74\x20\x62\x65\x67\x69\x6e\x3d"
@@ -562,7 +562,7 @@ jpeg_sm[] =  "\xff\xd8\xff\xe1\x00\x18\x45\x78\x69\x66\x00\x00\x49\x49\x2a\x00\x
 
 /* NG_Icon_120x120.jpg */
 unsigned char
-jpeg_lrg[] = "\xff\xd8\xff\xe1\x00\x18\x45\x78\x69\x66\x00\x00\x49\x49\x2a\x00\x08\x00\x00\x00\x00\x00\x00\x00"
+_jpeg_lrg[] = "\xff\xd8\xff\xe1\x00\x18\x45\x78\x69\x66\x00\x00\x49\x49\x2a\x00\x08\x00\x00\x00\x00\x00\x00\x00"
              "\x00\x00\x00\x00\xff\xec\x00\x11\x44\x75\x63\x6b\x79\x00\x01\x00\x04\x00\x00\x00\x64\x00\x00\xff"
              "\xe1\x03\x2b\x68\x74\x74\x70\x3a\x2f\x2f\x6e\x73\x2e\x61\x64\x6f\x62\x65\x2e\x63\x6f\x6d\x2f\x78"
              "\x61\x70\x2f\x31\x2e\x30\x2f\x00\x3c\x3f\x78\x70\x61\x63\x6b\x65\x74\x20\x62\x65\x67\x69\x6e\x3d"
@@ -1104,7 +1104,7 @@ jpeg_lrg[] = "\xff\xd8\xff\xe1\x00\x18\x45\x78\x69\x66\x00\x00\x49\x49\x2a\x00\x
 #elif __FreeBSD__
 /* Small Daemon PNG image */
 unsigned char
-png_sm[] =	"\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x29\x00\x00\x00\x30"
+_png_sm[] =	"\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x29\x00\x00\x00\x30"
 		"\x08\x06\x00\x00\x00\x8c\xb9\x53\xa5\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00"
 		"\x00\x06\x62\x4b\x47\x44\x00\xff\x00\xff\x00\xff\xa0\xbd\xa7\x93\x00\x00\x00\x09\x70\x48\x59\x73"
 		"\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xdc\x03"
@@ -1264,7 +1264,7 @@ png_sm[] =	"\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00
 
 /* Large Daemon PNG image */
 unsigned char
-png_lrg[] =	"\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x66\x00\x00\x00\x78"
+_png_lrg[] =	"\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x66\x00\x00\x00\x78"
 		"\x08\x06\x00\x00\x00\x00\x03\x87\x89\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00"
 		"\x00\x06\x62\x4b\x47\x44\x00\xff\x00\xff\x00\xff\xa0\xbd\xa7\x93\x00\x00\x00\x09\x70\x48\x59\x73"
 		"\x00\x00\x0b\x13\x00\x00\x0b\x13\x01\x00\x9a\x9c\x18\x00\x00\x00\x07\x74\x49\x4d\x45\x07\xdc\x03"
@@ -1932,7 +1932,7 @@ png_lrg[] =	"\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x0
 
 /* Small Daemon JPEG image */
 unsigned char
-jpeg_sm[] =	"\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x01\x00\x48\x00\x48\x00\x00\xff\xdb\x00\x43"
+_jpeg_sm[] =	"\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x01\x00\x48\x00\x48\x00\x00\xff\xdb\x00\x43"
 		"\x00\x05\x03\x04\x04\x04\x03\x05\x04\x04\x04\x05\x05\x05\x06\x07\x0c\x08\x07\x07\x07\x07\x0f\x0b"
 		"\x0b\x09\x0c\x11\x0f\x12\x12\x11\x0f\x11\x11\x13\x16\x1c\x17\x13\x14\x1a\x15\x11\x11\x18\x21\x18"
 		"\x1a\x1d\x1d\x1f\x1f\x1f\x13\x17\x22\x24\x22\x1e\x24\x1c\x1e\x1f\x1e\xff\xdb\x00\x43\x01\x05\x05"
@@ -1984,7 +1984,7 @@ jpeg_sm[] =	"\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x01\x00\x48\x0
 
 /* Large Daemon JPEG image */
 unsigned char
-jpeg_lrg[] =	"\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x01\x00\x48\x00\x48\x00\x00\xff\xdb\x00\x43"
+_jpeg_lrg[] =	"\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x01\x00\x48\x00\x48\x00\x00\xff\xdb\x00\x43"
 		"\x00\x05\x03\x04\x04\x04\x03\x05\x04\x04\x04\x05\x05\x05\x06\x07\x0c\x08\x07\x07\x07\x07\x0f\x0b"
 		"\x0b\x09\x0c\x11\x0f\x12\x12\x11\x0f\x11\x11\x13\x16\x1c\x17\x13\x14\x1a\x15\x11\x11\x18\x21\x18"
 		"\x1a\x1d\x1d\x1f\x1f\x1f\x13\x17\x22\x24\x22\x1e\x24\x1c\x1e\x1f\x1e\xff\xdb\x00\x43\x01\x05\x05"
@@ -2127,7 +2127,7 @@ jpeg_lrg[] =	"\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x01\x00\x48\x
 #else
 /* Small Tux PNG image */
 unsigned char
-png_sm[] =   "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x29\x00\x00\x00\x30"
+_png_sm[] =   "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x29\x00\x00\x00\x30"
              "\x08\x06\x00\x00\x00\x8c\xb9\x53\xa5\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00"
              "\x08\xf3\x49\x44\x41\x54\x58\xc3\xc5\x99\x7b\x6c\x53\xd7\x19\xc0\x7f\xf7\x5e\x3f\x62\xe7\x69\x02"
              "\x24\x4b\x52\xe2\x84\x24\x24\x24\x83\x50\x5a\x06\x6b\x80\x96\x74\xa5\x1b\x63\xd5\xe8\xd6\x69\x65"
@@ -2229,7 +2229,7 @@ png_sm[] =   "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x
 
 /* Large Tux PNG image */
 unsigned char
-png_lrg[] =  "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x66\x00\x00\x00\x78"
+_png_lrg[] =  "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x00\x00\x00\x66\x00\x00\x00\x78"
              "\x08\x06\x00\x00\x00\x00\x03\x87\x89\x00\x00\x00\x01\x73\x52\x47\x42\x00\xae\xce\x1c\xe9\x00\x00"
              "\x20\x00\x49\x44\x41\x54\x78\xda\xed\x9d\x79\x78\x64\x55\x9d\xf7\x3f\xe7\xde\x5b\x7b\x65\xdf\xd3"
              "\x7b\xd2\x49\xba\x09\xe9\x25\x0d\x74\xb3\x0c\x8d\xd0\x80\x88\xe0\x23\xa3\x88\x40\x3f\xe0\x20\xca"
@@ -2588,7 +2588,7 @@ png_lrg[] =  "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x48\x44\x52\x
 
 /* Small Tux JPEG image */
 unsigned char
-jpeg_sm[] =  "\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x01\x00\x5a\x00\x5a\x00\x00\xff\xdb\x00\x43"
+_jpeg_sm[] =  "\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x01\x00\x5a\x00\x5a\x00\x00\xff\xdb\x00\x43"
              "\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x02\x02\x03\x02\x02\x02\x02\x02\x04\x03"
              "\x03\x02\x03\x05\x04\x05\x05\x05\x04\x04\x04\x05\x06\x07\x06\x05\x05\x07\x06\x04\x04\x06\x09\x06"
              "\x07\x08\x08\x08\x08\x08\x05\x06\x09\x0a\x09\x08\x0a\x07\x08\x08\x08\xff\xdb\x00\x43\x01\x01\x01"
@@ -2673,7 +2673,7 @@ jpeg_sm[] =  "\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x01\x00\x5a\x
 
 /* Large Tux JPEG image */
 unsigned char
-jpeg_lrg[] = "\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x01\x00\x5a\x00\x5a\x00\x00\xff\xdb\x00\x43"
+_jpeg_lrg[] = "\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x01\x00\x5a\x00\x5a\x00\x00\xff\xdb\x00\x43"
              "\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x02\x02\x03\x02\x02\x02\x02\x02\x04\x03"
              "\x03\x02\x03\x05\x04\x05\x05\x05\x04\x04\x04\x05\x06\x07\x06\x05\x05\x07\x06\x04\x04\x06\x09\x06"
              "\x07\x08\x08\x08\x08\x08\x05\x06\x09\x0a\x09\x08\x0a\x07\x08\x08\x08\xff\xdb\x00\x43\x01\x01\x01"
@@ -2929,3 +2929,15 @@ jpeg_lrg[] = "\xff\xd8\xff\xe0\x00\x10\x4a\x46\x49\x46\x00\x01\x01\x01\x00\x5a\x
              "\x1e\x88\x20\xa8\xd8\xba\xe2\x7e\xdc\x26\x9a\x69\x08\xf7\x22\x22\x02\x82\x28\x82\x29\xe8\x88\x9e"
              "\xda\x69\xa6\x90\x8f\xff\xd9";
 #endif
+
+char *png_sm = (char*) _png_sm;
+size_t png_sm_size = sizeof(_png_sm);
+
+char *png_lrg = (char*) _png_lrg;
+size_t png_lrg_size = sizeof(_png_lrg);
+
+char *jpeg_sm = (char*) _jpeg_sm;
+size_t jpeg_sm_size = sizeof(_jpeg_sm);
+
+char *jpeg_lrg = (char*) _jpeg_lrg;
+size_t jpeg_lrg_size = sizeof(_jpeg_lrg);
diff --git a/icons.h b/icons.h
new file mode 100644
index 0000000..af4e3bc
--- /dev/null
+++ b/icons.h
@@ -0,0 +1,11 @@
+extern char *png_sm;
+extern size_t png_sm_size;
+
+extern char *png_lrg;
+extern size_t png_lrg_size;
+
+extern char *jpeg_sm;
+extern size_t jpeg_sm_size;
+
+extern char *jpeg_lrg;
+extern size_t jpeg_lrg_size;
diff --git a/minidlna.c b/minidlna.c
index 10b4806..2a27727 100644
--- a/minidlna.c
+++ b/minidlna.c
@@ -95,6 +95,7 @@
 #include "tivo_beacon.h"
 #include "tivo_utils.h"
 #include "avahi.h"
+#include "icons.h"
 
 #if SQLITE_VERSION_NUMBER < 3005001
 # warning "Your SQLite3 library appears to be too old!  Please use 3.5.1 or newer."
@@ -752,6 +753,68 @@ init(int argc, char **argv)
 			if (strcasecmp(ary_options[i].value, "beacon") == 0)
 				CLEARFLAG(TIVO_BONJOUR_MASK);
 			break;
+		case ICON_PNG_SM:
+		case ICON_PNG_LRG:
+		case ICON_JPEG_SM:
+		case ICON_JPEG_LRG:
+			{
+				FILE *f = fopen(ary_options[i].value, "rb");
+				if (f == NULL)
+				{
+					DPRINTF(E_WARN, L_GENERAL, "Icon file not found: %s\n", ary_options[i].value);
+					DPRINTF(E_WARN, L_GENERAL, "Fallback to default icon!\n");
+					break;
+				}
+				fseek(f, 0, SEEK_END);
+				size_t fsize = ftell(f);
+				if (fsize >= 192*1024)
+				{
+					fclose(f);
+					DPRINTF(E_WARN, L_GENERAL, "Icon file to big! Maximum is 192kB! [%s]\n", ary_options[i].value);
+					DPRINTF(E_WARN, L_GENERAL, "Fallback to default icon!\n");
+					break;
+				}
+				fseek(f, 0, SEEK_SET);
+				char *data = malloc(fsize);
+				if (!data)
+				{
+					fclose(f);
+					DPRINTF(E_WARN, L_GENERAL, "Not enough memory to load icon!\n");
+					DPRINTF(E_WARN, L_GENERAL, "Fallback to default icon!\n");
+					break;
+				}
+				if (fread(data, 1, fsize, f) != fsize)
+				{
+					fclose(f);
+					free(data);
+					DPRINTF(E_WARN, L_GENERAL, "I/O error while reading icon file: %s!\n", ary_options[i].value);
+					DPRINTF(E_WARN, L_GENERAL, "Fallback to default icon!\n");
+					break;
+				}
+				fclose(f);
+
+				switch (ary_options[i].id)
+				{
+				case ICON_PNG_SM:
+					png_sm = data;
+					png_sm_size = fsize;
+					break;
+				case ICON_PNG_LRG:
+					png_lrg = data;
+					png_lrg_size = fsize;
+					break;
+				case ICON_JPEG_SM:
+					jpeg_sm = data;
+					jpeg_sm_size = fsize;
+					break;
+				case ICON_JPEG_LRG:
+					jpeg_lrg = data;
+					jpeg_lrg_size = fsize;
+					break;
+				default:;
+				}
+			}
+			break;
 		default:
 			DPRINTF(E_ERROR, L_GENERAL, "Unknown option in file %s\n",
 				optionsfile);
diff --git a/minidlna.conf.5 b/minidlna.conf.5
index d02fd46..da8ac50 100644
--- a/minidlna.conf.5
+++ b/minidlna.conf.5
@@ -171,6 +171,16 @@ force_sort_criteria=+upnp:class,+upnp:originalTrackNumber,+dc:title
 Set to 'yes' to allow symlinks that point outside user-defined media_dirs.
 By default, wide symlinks are not followed.
 
+.IP "\fBicon_[format]_[size]\fP"
+Set these options to the filepath to your custom icon file.
+.nf
+The possible options are:
+             icon_png_small
+             icon_png_large
+             icon_jpeg_small
+             icon_jpeg_large
+.fi
+
 
 
 .SH VERSION
diff --git a/options.c b/options.c
index 79e4ffe..6322fa1 100644
--- a/options.c
+++ b/options.c
@@ -67,6 +67,10 @@ static const struct {
 	{ MERGE_MEDIA_DIRS, "merge_media_dirs" },
 	{ WIDE_LINKS, "wide_links" },
 	{ TIVO_DISCOVERY, "tivo_discovery" },
+	{ ICON_PNG_SM, "icon_png_small" },
+	{ ICON_PNG_LRG, "icon_png_large" },
+	{ ICON_JPEG_SM, "icon_jpeg_small" },
+	{ ICON_JPEG_LRG, "icon_jpeg_large" },
 };
 
 int
diff --git a/options.h b/options.h
index cb4c3be..f4c5e8f 100644
--- a/options.h
+++ b/options.h
@@ -60,6 +60,10 @@ enum upnpconfigoptions {
 	MERGE_MEDIA_DIRS,		/* don't add an extra directory level when there are multiple media dirs */
 	WIDE_LINKS,			/* allow following symlinks outside the defined media_dirs */
 	TIVO_DISCOVERY,			/* TiVo discovery protocol: bonjour or beacon. Defaults to bonjour if supported */
+	ICON_PNG_SM,			/* path to small png icon */
+	ICON_PNG_LRG,			/* path to large png icon */
+	ICON_JPEG_SM,			/* path to small jpeg icon */
+	ICON_JPEG_LRG,			/* path to large jpeg icon */
 };
 
 /* readoptionsfile()
diff --git a/upnphttp.c b/upnphttp.c
index 3b4b58a..2327667 100644
--- a/upnphttp.c
+++ b/upnphttp.c
@@ -1390,28 +1390,32 @@ SendResp_icon(struct upnphttp * h, char * icon)
 	{
 		DPRINTF(E_DEBUG, L_HTTP, "Sending small PNG icon\n");
 		data = (char *)png_sm;
-		size = sizeof(png_sm)-1;
+		//size = sizeof(png_sm)-1;
+		size = png_sm_size;
 		strcpy(mime+6, "png");
 	}
 	else if( strcmp(icon, "lrg.png") == 0 )
 	{
 		DPRINTF(E_DEBUG, L_HTTP, "Sending large PNG icon\n");
 		data = (char *)png_lrg;
-		size = sizeof(png_lrg)-1;
+		//size = sizeof(png_lrg)-1;
+		size = png_lrg_size;
 		strcpy(mime+6, "png");
 	}
 	else if( strcmp(icon, "sm.jpg") == 0 )
 	{
 		DPRINTF(E_DEBUG, L_HTTP, "Sending small JPEG icon\n");
 		data = (char *)jpeg_sm;
-		size = sizeof(jpeg_sm)-1;
+		//size = sizeof(jpeg_sm)-1;
+		size = jpeg_sm_size;
 		strcpy(mime+6, "jpeg");
 	}
 	else if( strcmp(icon, "lrg.jpg") == 0 )
 	{
 		DPRINTF(E_DEBUG, L_HTTP, "Sending large JPEG icon\n");
 		data = (char *)jpeg_lrg;
-		size = sizeof(jpeg_lrg)-1;
+		//size = sizeof(jpeg_lrg)-1;
+		size = jpeg_lrg_size;
 		strcpy(mime+6, "jpeg");
 	}
 	else