summaryrefslogtreecommitdiffstats
path: root/abs/core-testing/mythtv/old/stable-0.21/mythweb/patch/mythweb_gallery_updated1.diff
blob: f683b17bcf74b0fc219bba59372a86ea691fb9d5 (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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
diff -Naur ../mythweb-orig/modules/gallery/handler.php ./modules/gallery/handler.php
--- ../mythweb-orig/modules/gallery/handler.php	1969-12-31 19:00:00.000000000 -0500
+++ ./modules/gallery/handler.php	2007-08-20 22:33:02.000000000 -0400
@@ -0,0 +1,35 @@
+<?php
+/**
+ * Handler for the Gallery module.
+ *
+ * @url         $URL: http://svn.mythtv.org/svn/trunk/mythplugins/mythweb/modules/gallery/handler.php $
+ * @date        $Date: 2006-12-19 09:17:33 +0100 (Di, 19 Dez 2006) $
+ * @version     $Revision: 12295 $
+ * @author      $Author: rsiebert $
+ * @license     GPL
+ *
+ * @package     MythWeb
+ * @subpackage  MythGallery
+ *
+/**/
+
+// Load settings functions
+require_once 'includes/objects/Settings.php';
+
+// Load Gallery class
+require_once 'includes/objects/Gallery.php';
+
+// Load configuration
+loadGalleryConfig();
+
+// Create the gallery
+global $gallery;
+ 
+$gallery = new Gallery();
+
+// Print the gallery page template
+require_once tmpl_dir.'gallery.php';
+
+// Exit
+exit;
+
diff -Naur ../mythweb-orig/modules/gallery/includes/objects/Gallery.php ./modules/gallery/includes/objects/Gallery.php
--- ../mythweb-orig/modules/gallery/includes/objects/Gallery.php	1969-12-31 19:00:00.000000000 -0500
+++ ./modules/gallery/includes/objects/Gallery.php	2007-08-20 22:27:02.000000000 -0400
@@ -0,0 +1,608 @@
+<?php
+/**
+ * Gallery Functions for the Gallery module
+ *
+ * @url         $URL: http://svn.mythtv.org/svn/trunk/mythplugins/mythweb/modules/gallery/tmpl/default/gallery.php $
+ * @date        $Date: 2006-12-19 09:17:33 +0100 (Di, 19 Dez 2006) $
+ * @version     $Revision: 12295 $
+ * @author      $Author: xris $
+ * @license     GPL
+ *
+ * @package     MythWeb
+ *
+/**/
+
+class Gallery {
+
+	var $config;
+	
+	function Gallery() {
+		// load default configuration
+		$this->config['image_path'] 		= $_SESSION['gallery']['image_path'];
+		$this->config['cache_path'] 		= $_SESSION['gallery']['cache_path'];
+		$this->config['default_viewsize'] 	= $_SESSION['gallery']['default_viewsize'];
+		$this->config['screen_width'] 		= $_SESSION['gallery']['screen_width'];
+		$this->config['viewsizes'] 		= $_SESSION['gallery']['viewsizes'];
+ 		$this->config['valid_image_files'] 	= $_SESSION['gallery']['valid_image_files'];
+
+	}
+
+	// =======================================================
+	function start() {
+
+		// the current selected directory where the cached images are stored
+		$current_path = $this->getCurrentImagePath();
+		// the path to the real images
+		$image_path = $this->config['image_path'];
+		// the filename of a selected image
+		$image_name = $this->getImageName();
+		// the current viewsize mode
+		$image_viewsize = $this->getImageViewSize();
+		// get the image index for the viewsize medium
+		$image_index = $this->getImageIndex();
+		// get the contents of the folders
+		$folderList = $this->getFolderList( $current_path );
+		// check what kind of images should be displayed
+		if ($image_viewsize == 'fullsize') {
+			// create the images if there are not yet in the directory
+			$this->makeImages( $current_path, $folderList, $image_viewsize, $image_index );
+			// display the big image
+			$this->showFullsizeImage( $current_path, $folderList, $image_index );
+			// there is nothing else to do
+			exit;
+		}
+		// show the horizontal navigation bar
+		$this->showGalleryHeader( $current_path, $image_viewsize, $image_index );		
+		// check if the thumbnail directory is there, if not create it
+		$this->makeDirectory( $current_path );
+		// create the images if there are not yet in the directory
+		$this->makeImages( $current_path, $folderList, $image_viewsize, $image_index );
+		echo '<table width="100%" cellspacing="0" cellpadding="0">'."\n".
+			'<tr>'."\n".
+				'<td class="folder_navigation">'."\n";
+					$this->showFolderTree( $current_path, $folderList );
+				echo '</td>'."\n".
+				'<td class="image_listing">'."\n";
+					if ($this->onlyDirectoriesAvailable( $current_path, $folderList, $image_viewsize, $image_index ) == false ) {
+						echo '<table class="imagelist_and_navigation" cellspacing="0" cellpadding="0">'."\n".
+						'<tr>'."\n".
+							'<td>'."\n";
+								$this->showNavigation( $current_path, $folderList, $image_viewsize, $image_index );
+							echo '</td>'."\n".
+							'</tr>'."\n".
+							'<tr>'."\n".
+								'<td>'."\n";
+									$this->showImages( $current_path, $folderList, $image_viewsize, $image_index );
+							echo '</td>'."\n".
+							'</tr>'."\n".
+						'</tr>'."\n".
+						'</table>'."\n";
+					} else {
+						echo '&nbsp;';
+					}
+				echo '</td>'."\n".
+			'</tr>'."\n".			
+		'</table>'."\n";
+	}
+	
+	// =======================================================
+	function getViewSizesList() {
+		$viewsizesList = explode(';',preg_replace('/ /','',$this->config['viewsizes']));
+		return $viewsizesList;
+	}
+
+
+	// =======================================================
+	function getCurrentImagePath() {
+		switch ($_SERVER['REQUEST_METHOD']) {
+			case 'GET':
+				$current_path = stripslashes($_GET['path']);
+				break;
+			case 'POST':
+				$current_path = stripslashes($_POST['path']);
+				break;
+		}
+		if (!is_dir($current_path) ) {
+			$current_path = $this->config['image_path'];
+		}
+ 		return $current_path;
+	}
+	
+	// =======================================================
+	function getImageViewSize() {
+		switch ($_SERVER['REQUEST_METHOD']) {
+			case 'GET':
+				$viewsize = stripslashes($_GET[viewsize]);
+				break;
+			case 'POST':
+				$viewsize = stripslashes($_POST[viewsize]);
+				break;
+		}	
+		// check if the given viewsize is one of the viewsizes
+		// specified in the config. fullsize is also needed
+		if (isset($viewsize) && 
+			(($viewsize == 'fullsize') ||  
+			in_array($viewsize, $this->getViewSizesList()))) {
+			return $viewsize;
+		} else {
+			return $this->config['default_viewsize'];
+		}
+	}
+	
+	// =======================================================
+	function getImageName() {
+		switch ($_SERVER['REQUEST_METHOD']) {
+			case 'GET':
+				$image_name = $_GET['file'];
+				break;
+			case 'POST':
+				$image_name = $_POST['file'];
+				break;
+		}	
+		return $image_name;
+	}
+
+	// =======================================================
+	function getImageIndex() {
+		if (isset($_GET['index'])) 	
+			return $_GET['index'];
+		return 1;
+	}
+	
+	
+	// =======================================================
+	// displays the path of the choosen directories horizontally 
+	// so one can navigate back
+	function showGalleryHeader( $current_path, $image_viewsize, $image_index ) {
+		echo '<table class="current_path_and_viewsize" cellspacing="0" cellpadding="0">'."\n".
+			'<tr>'."\n".
+				'<td class="current_path">'.
+					t('Current path').': ';
+					$folders = explode('/', $current_path);
+					for ($i=1; $i < count($folders); $i++) {
+						echo '<a class="header" href="'.root.'gallery/gallery.php?'.path.'=';
+						// show thefolders in the navigation bar
+						for ($j=1; $j <= $i; $j++) {
+							echo '/'.$folders[$j];
+						}
+						echo '&'.viewsize.'='.$this->getImageViewSize().'">'.
+						$folders[$i].'</a>'."\n";
+						// don't show the separators when there are no more subfolders
+						if ($i < (count($folders)-1)) {
+							echo ' / ';
+						}
+					}
+				// display the menu where one can shoose between small and medium images
+				echo '</td>'."\n".
+					'<td class="change_viewsize_text">'.
+						t('Switch view mode').':&nbsp;&nbsp;'.
+					'</td>'."\n".
+					'<form name="change_viewsize" method="post">'."\n".
+					'<td class="change_viewsize_selection">'."\n".
+						'<select class="change_viewsize" name="'.
+							viewsize.'" onChange="submit()" size="1">'."\n";
+							$viewsizesList = $this->getViewSizesList();
+							for ($i=0; $i < count($viewsizesList); $i++) {
+								echo '<option value="'.$viewsizesList[$i].'" ';
+								if ($this->getImageViewSize() == $viewsizesList[$i]) {
+									echo 'selected';
+								}
+								$str = strtr($viewsizesList[$i], ',','x');
+								echo '>'.$str.' '.t('Images per page').'</option>'."\n";
+							}
+					echo '</select>'."\n".
+						'<input type="hidden" name="'.index.'" value="'.$image_index.'">'.
+						'<input type="hidden" name="'.path.'" value="'.$current_path.'">';
+				echo '</td></form>'."\n".
+			'</tr>'."\n".
+		'</table>'."\n";
+	}
+	
+	// =======================================================
+	function showFolderTree( $current_path, $folderList ) {
+
+		// dont go into the directory if there are not subdirs
+		if ($this->getFolderCount( $current_path, $folderList[$i]) == 0) {
+			$current_path = substr($current_path, 0, strrpos($current_path, '/'));
+			$folderList = $this->getFolderList( $current_path );
+		}
+		// displays the directory tree and the pictures
+		echo '<table class="folder_navigation" width="100%" cellspacing="0" cellpadding="0">'."\n".
+			'<tr>'."\n".
+				'<td>'."\n";
+					// display the directories
+					for ($i = 0; $i < count( $folderList ); $i++) {
+						// only display folders that are not hidden or special
+						if ((is_dir( $current_path.'/'.$folderList[$i] )) &&
+							($folderList[$i] != '..')){
+							echo '<div class="folder_navigation" '.
+							'onmouseover="this.className=\'folder_navigation_active\'" '.
+							'onmouseout="this.className=\'folder_navigation\'">';
+								$link = $this->getFolderLink( $current_path, $folderList[$i] );	
+								$folderCount = $this->getFolderCount( $current_path, $folderList[$i] );
+								// display the folder as a link and the number of subfolder next to it
+								$this->displayFolderLink( $link, $folderList[$i], $folderCount );
+							echo '</div>';
+						}
+					}
+				echo '</td>'."\n".
+			'</tr>'."\n".
+		'</table>'."\n";
+	}
+
+	// =======================================================
+	function getFolderList( $current_path ) {
+		if ($current_path != $this->config['cache_path'] ) {
+			$folderList[] = '..';
+		}
+		// get the image extensions
+		$extenstionList = explode(',',$this->config['valid_image_files']);
+		// get the directories and files
+		if ($dh = opendir($current_path)) {
+			while (($file = readdir($dh)) !== false) {
+				// only add the file/dir if its a directory or a file
+				// with the specified extension
+
+				if ((substr($file,0,1) != '.') && 
+					(is_dir($current_path.'/'.$file)) ||
+					(in_array(strtolower(substr($file,-3)), $extenstionList)))
+				{
+					$folderList[] = $file;
+				}
+			}
+		}
+		// delete the first entry when we are at the image_path
+		// to prevent from going a directory up
+		if ($current_path == $this->config['image_path'])
+			array_shift($folderList);
+		// sort the array alphabetically
+		sort($folderList);
+		return $folderList;
+	}	
+	
+	// =======================================================
+	function getFolderLink( $current_path, $folder ) {
+		$link = '<a class="folderlist" href="'.root.'gallery/gallery.php?'.path.'=';
+		// display the .. directory only if there is another
+		// directory above this one.
+		if (($folder == '..') && ($current_path != $this->config['cache_path'])) {
+			$folderList = explode( '/', $current_path.'/');
+			for( $i=1; $i < count($folderList)-2; $i++ ) {
+				$link .= '/'.$folderList[$i];
+			}
+		} else {
+			$link .= $current_path.'/'.$folder;
+		}
+		$link .= '&'.viewsize.'='.$this->getImageViewSize().'">';
+		return $link;
+	}
+
+	// =======================================================
+	function displayFolderLink( $link, $folder, $folderCount ) {
+		echo '<table class="folderlink_inactive" cellspacing="0" cellpadding="0">'.
+			'<tr>'.
+				'<td align="left" width="30px">'.
+					'<img class="navigation" src="'.root.skin_dir.'/img/gallery/dir.png">'.
+				'</td>'.
+				'<td align="left" width="auto">'.
+					$link.$folder.'</a>';
+					$this->displayFolderCount( $folderCount );
+				echo '</td>'.
+			'</tr>'.
+		'</table>'."\n";
+	}
+
+	// =======================================================
+	function getFolderCount($current_path, $folder) {
+		// dont get the folder count if its the .. directory
+		if ($folder != '..') {
+			return count(glob($current_path.'/'.$folder.'/*',GLOB_ONLYDIR));
+		}
+	}
+
+	// =======================================================
+	// shows how many sub directories the specified folder has
+	function displayFolderCount( $folderCount ) {
+		if ($folderCount == 1) { 
+			echo ' ('.$folderCount.')';// '.t('subfolder'); 
+		} 
+		if ($folderCount > 1) {
+			echo ' ('.$folderCount.')';// '.t('subfolders'); 
+		}
+	}
+
+	
+	// =======================================================
+	// creates the directory for the thumbnails. the directory
+	// structure is identical to the one of original pictures
+	function makeDirectory( $current_path ) {
+		if (!file_exists( $this->config['cache_path'].$current_path )) {
+			// add the document root to the thumbnail directory
+			// because mkdir works with absolute paths
+			$cache_path = $_SERVER[DOCUMENT_ROOT].$this->config['cache_path'];
+			// split the directory string into separate directories
+			$folderList = explode( '/', $current_path );
+			// go through all folder and create each one
+			for($i=1; $i < count($folderList); $i++) {
+				$cache_path .= '/'.$folderList[$i];
+				// check if the directory is already there
+				if (!file_exists($cache_path)) {
+					mkdir ($cache_path);
+				}
+			}
+		}
+	}
+
+	// =======================================================
+	// check if the images are there, if not create them 
+	function makeImages( $current_path, $folderList, $image_viewsize, $image_index ) {
+		$path = $_SERVER[DOCUMENT_ROOT].$this->config['cache_path'].$current_path;
+		// use the image_viewsize numbers as a prefix if fullsize is not requested
+		if ( $image_viewsize != fullsize ) {
+			// only so many images will be created that will be displayed on the screen
+			$max_cols = substr($image_viewsize, 0, 1);
+			$max_rows = substr($image_viewsize, 2, 1);
+			$max_number = ($max_cols * $max_rows);
+			// the prefix that will be added to a file so that 
+			// different sizes have different names
+			$file_prefix = strtr($image_viewsize, ',','_').'_';
+		} else {
+			$max_number = 1;
+			// the prefix that will be added to a file so that 
+			// different sizes have different names
+			$file_prefix = $image_viewsize.'_';
+		}
+		// get the amount of subfolders. increase the count in the loop by these
+		// subfolders
+		$folder_count = count(glob($current_path.'/'.$folder.'/*',GLOB_ONLYDIR));
+		for ($i = $image_index; $i < ($max_number + $image_index + $folder_count); $i++) {
+			// show the picture only if its not hidden and not a directory
+			if (!is_dir( $current_path.'/'.$folderList[$i] )) {
+				// check if there is already a thumbnail available, if not create it
+				if (!file_exists( $path.'/'.$file_prefix.$folderList[$i] )) {
+					// get the extension of the file
+					$fileParts = explode('.', $folderList[$i]);
+					$file_extension = strtolower($fileParts[count($fileParts)-1]);
+					// get image pointer
+					$image_p = null;
+					if ($file_extension == 'jpg')
+						$image_p = @imagecreatefromjpeg( $current_path.'/'.$folderList[$i] );
+					if ($file_extension == 'png')
+						$image_p = @imagecreatefrompng( $current_path.'/'.$folderList[$i] );
+					if ($file_extension == 'gif')
+						$image_p = @imagecreatefromgif( $current_path.'/'.$folderList[$i] );
+					// proceed if we have an image pointer
+					if ($image_p) {
+						// get the image size for the cached images
+						$size = getimagesize( $current_path.'/'.$folderList[$i]);
+						$width = $size[0];
+						$height = $size[1];
+						// get the width for the choosen viewsize
+						// calculate it from the columns and rows if fullsize is not
+						// requested, otherwise use the original image size
+						if ( $image_viewsize != fullsize ) {
+							$new_width = (( $this->config['screen_width'] / $max_cols ) - 50 );
+							// calculate new image dimensions
+							$new_height = ($height/$width) * $new_width;
+							if ( $height > $width ) {
+								$new_width = ($width/$height) * $new_height;
+							}
+						} else {
+							$new_width = $width;
+							$new_height = $height;
+						}
+						// get a new image pointer
+						$new_image_p = imagecreatetruecolor($new_width, $new_height);
+						// resample the old image to the new one
+						imagecopyresampled($new_image_p, $image_p, 0, 0, 0, 0,
+							$new_width, $new_height, $width, $height );
+						// save the image
+						if ($file_extension == 'jpg')
+							imagejpeg($new_image_p, $path.'/'.$file_prefix.$folderList[$i] );
+						if ($file_extension == 'png')
+							imagepng($new_image_p, $path.'/'.$file_prefix.$folderList[$i] );
+						if ($file_extension == 'gif')
+							imagegif($new_image_p, $path.'/'.$file_prefix.$folderList[$i] );
+						// destroy the old pointers
+						imagedestroy( $image_p );
+						imagedestroy( $new_image_p );
+					}
+				}
+			}
+		}
+	}
+
+	// =======================================================
+	function showImages( $current_path, $folderList, $image_viewsize, $image_index ) {
+
+		$path = $_SERVER[DOCUMENT_ROOT].$this->config['cache_path'].$current_path;
+		// get the column and row values, display that many images in a row
+		$max_cols = substr($image_viewsize, 0, 1);
+		$max_rows = substr($image_viewsize, 2, 1);
+		// counter for the current column and row
+		$current_col = 0;
+		// the prefix that will be added to a file so that different sizes have different names
+		$file_prefix = strtr($image_viewsize, ',','_').'_';
+		
+		// get the amount of subfolders
+		$folder_count = count(glob($current_path.'/'.$folder.'/*',GLOB_ONLYDIR));
+		// increase the index by the folder count
+		for ($i = 1; $i <= $folder_count; $i++) {
+			$image_index += 1;
+		}
+		echo '<table width="100%" cellspacing="0" cellpadding="0">'."\n".
+			'<tr>'.
+				'<td colspan="'.$max_cols.'">'.
+					'&nbsp;'.
+				'</td>'.
+			'</tr>';
+			// go through all entries in the folderList	
+			for ($i = $image_index; $i < (($max_cols * $max_rows)+$image_index); $i++) {
+				if (( file_exists( $path.'/'.$file_prefix.$folderList[$i] )) && 
+					( isset($folderList[$i]) )) {
+					// if the column is zero then start a new row
+					// the specified number of images will be displayed side by side
+					if ( $current_col == 0 ) echo '<tr>'."\n";
+					// stretch the table cells to equal size
+					echo '<td class="single_image" style="width:';
+						// calculate the width of the cells
+						echo floor( 100 / $max_cols );
+						echo '%;">'."\n".
+						// display the image centered and put border around it
+						'<div align="center">'."\n".
+							'<a href="'.root.'gallery/gallery.php?'.
+							    path.'='.$current_path.
+							'&'.index.'='.$i.
+							'&'.viewsize.'='.fullsize.
+							'" target="blank">'."\n".
+							'<img class="single_image" src="'.
+								$this->config['cache_path'].$current_path.'/'.
+									$file_prefix.$folderList[$i].'" '.
+							'onmouseover="this.className=\'single_image_active\'" '.
+							'onmouseout="this.className=\'single_image\'">'."\n".
+							'</a>'."\n".
+						'</div>'."\n".
+						'<div align="center">'."\n".
+							// show the filename
+							$folderList[$i]."\n".
+						'</div>'."\n".
+					'</td>'."\n";
+					// if the max number of columns are reached close the row
+					if ( $current_col == $max_cols ) echo '</tr>'."\n";
+					// reset the column count back to zero
+					$current_col++;
+					if ( $current_col == $max_cols ) $current_col = 0;
+				}
+			}
+		echo '</table>';
+	}
+
+
+	// =======================================================
+	function onlyDirectoriesAvailable( $current_path, $folderList, $image_viewsize, $image_index ) {
+		$path = $_SERVER[DOCUMENT_ROOT].$this->config['cache_path'].$current_path;
+		// only so many images will be created that will be displayed on the screen
+		$max_cols = substr($image_viewsize, 0, 1);
+		$max_rows = substr($image_viewsize, 2, 1);
+		$max_number = ($max_cols * $max_rows);
+		// the prefix that will be added to a file so that different sizes have different names
+		$file_prefix = strtr($image_viewsize, ',','_').'_';
+
+		// go through the folderList. if there are only directories in it
+		// then dont display the navigation stuff
+		$only_dirs = true;		
+		for ($i = 0; $i < count($folderList); $i++) {
+			if ( file_exists( $path.'/'.$file_prefix.$folderList[$i] )) {
+				$only_dirs = false;
+				break;
+			}
+		}
+		return $only_dirs;
+	}
+
+	// =======================================================
+	function showNavigation( $current_path, $folderList, $image_viewsize, $image_index ) {
+		$path = $_SERVER[DOCUMENT_ROOT].$this->config['cache_path'].$current_path;
+		// only so many images will be created that will be displayed on the screen
+		$max_cols = substr($image_viewsize, 0, 1);
+		$max_rows = substr($image_viewsize, 2, 1);
+		$max_number = ($max_cols * $max_rows);
+		// the prefix that will be added to a file so that different sizes have different names
+		$file_prefix = strtr($image_viewsize, ',','_').'_';
+
+		echo '<table width="100%" cellspacing="0" cellpadding="0">'."\n".
+		'<tr>'."\n".
+			'<td class="image_navigation">&nbsp;'."\n".
+			'</td>'."\n".
+			'<td class="image_navigation">'."\n";							
+				// display the goto first page link
+				if ($image_index != 1) {
+					echo '<a href="'.root.'gallery/gallery.php?'.
+						'&'.path.'='.$current_path.
+						'&'.index.'=1'.
+						'&'.viewsize.'='.$image_viewsize.'">'."\n".
+						// display the right arrow
+						'<img src="'.root.skin_dir.'/img/gallery/first_page.png">'.
+					'</a>'."\n";
+				} else {
+					echo '<img src="'.root.skin_dir.'/img/gallery/first_page_disabled.png">'."\n";
+				}
+				// display the previous page icon if there are more than one entries
+				if ($image_index != 1) {
+					echo '<a href="'.root.'gallery/gallery.php?'.
+						'&'.path.'='.$current_path.
+						'&'.index.'=';
+						if ($image_index < $max_number) {
+							echo 1;
+						} else {
+							echo ($image_index - $max_number);
+						}
+						echo '&'.viewsize.'='.$image_viewsize.'">'."\n".
+						// display the left arrow
+						'<img src="'.root.skin_dir.'/img/gallery/prev_page.png">'.
+					'</a>'."\n";
+				} else {
+					echo '<img src="'.root.skin_dir.'/img/gallery/prev_page_disabled.png">'."\n";
+				}
+			echo '</td>'."\n".
+			'<td class="image_navigation">'."\n".
+				// display an info in what page we are right now
+				'( '.$image_index.' '.t('to').' ';
+				if (($image_index + $max_number) < count($folderList)) {
+					echo ($image_index+$max_number-1);
+				} else {
+					echo (count($folderList)-1);
+				}
+				echo ' '.t('of').' '.(count($folderList)-1).' )'."\n".
+			'</td>'."\n".
+			'<td class="image_navigation">'."\n";
+				// display the next page link
+				if (($image_index + $max_number) < count($folderList)) {
+					echo '<a href="'.root.'gallery/gallery.php?'.
+						'&'.path.'='.$current_path.
+						'&'.index.'='.($image_index + $max_number).
+						'&'.viewsize.'='.$image_viewsize.'">'."\n".
+						// display the right arrow
+						'<img src="'.root.skin_dir.'/img/gallery/next_page.png">'.
+					'</a>'."\n";
+				} else {
+					echo '<img src="'.root.skin_dir.'/img/gallery/next_page_disabled.png">'."\n";
+				}
+				// display the goto last page link
+				if (($image_index + $max_number) < count($folderList)) {
+					echo '<a href="'.root.'gallery/gallery.php?'.
+						'&'.path.'='.$current_path.
+						'&'.index.'='.
+							(count($folderList) - (count($folderList) % $max_number)+1).
+						'&'.viewsize.'='.$image_viewsize.'">'."\n".
+						// display the right arrow
+						'<img src="'.root.skin_dir.'/img/gallery/last_page.png">'.
+					'</a>'."\n";
+				} else {
+					echo '<img src="'.root.skin_dir.'/img/gallery/last_page_disabled.png">'."\n";
+				}
+			echo '</td>'."\n".
+			'<td class="image_navigation">&nbsp;'."\n".
+			'</td>'."\n".
+		'</tr>'."\n".
+		'</table>'."\n";
+	}
+	
+	// =======================================================
+	function showFullsizeImage( $current_path, $folderList, $image_index ) {
+		echo '<html>'."\n".
+		'<head>'."\n".
+			'<title>'.$folderList[$image_index].'</title>'."\n".
+		'</head>'."\n".
+		'<body>'."\n".
+			'<div>'."\n".
+			'<img src="'."\n".
+				$this->config['cache_path'].$current_path.'/'.
+				fullsize.'_'.$folderList[$image_index].'">'."\n".
+			'</div>'."\n".
+		'</body>'."\n".
+		'</html>';
+	}
+
+	// =======================================================
+}
diff -Naur ../mythweb-orig/modules/gallery/includes/objects/Settings.php ./modules/gallery/includes/objects/Settings.php
--- ../mythweb-orig/modules/gallery/includes/objects/Settings.php	1969-12-31 19:00:00.000000000 -0500
+++ ./modules/gallery/includes/objects/Settings.php	2007-08-20 22:28:02.000000000 -0400
@@ -0,0 +1,243 @@
+<?php
+/**
+ * Gallery Settings Functions
+ *
+ * @url         $URL: http://svn.mythtv.org/svn/trunk/mythplugins/mythweb/modules/gallery/set_prefs.php $
+ * @date        $Date: 2006-12-19 09:17:33 +0100 (Di, 19 Dez 2006) $
+ * @version     $Revision: 12295 $
+ * @author      $Author: xris $
+ * @license     GPL
+ *
+ * @package     MythWeb
+ * @subpackage  Gallery
+/**/
+
+// Load the available configuration from the session variable 
+// or if this one is empty then form the database 
+function loadGalleryConfig()
+{
+	$_SESSION['gallery']['image_path'] = getGalleryImagePath();
+	$_SESSION['gallery']['cache_path'] = getGalleryCachePath();
+	$_SESSION['gallery']['default_viewsize'] = getGalleryDefaultViewSize();
+	$_SESSION['gallery']['screen_width'] = getGalleryScreenWidth();
+	$_SESSION['gallery']['viewsizes'] = getGalleryViewSizes();
+	$_SESSION['gallery']['valid_image_files'] = getGalleryValidImageFiles();
+}
+
+
+// Load all of the known mythtv frontend hosts
+function getGalleryHostnames()
+{	
+	$Settings_Hosts = array('' => t('MythWeb Session'));
+	global $db;
+	$sh = $db->query('SELECT DISTINCT hostname FROM settings WHERE value="locale" ORDER BY hostname');
+	
+	// add all the found hosts into an array 
+	while (list($host) = $sh->fetch_row()) 
+	{
+		if (empty($host)) 
+			continue;
+		$Settings_Hosts[$host] = $host;
+	}
+	$sh->finish();
+	return $Settings_Hosts;
+}
+
+
+// update the values in the database if necessary
+function saveGalleryConfig( $Settings_Hosts )
+{
+	// Make sure we have a valid host selected
+	if (!isset( $Settings_Hosts[$_SESSION['settings']['host']]) ) 
+	{
+		// we have no valid host, reset the array 
+		$_SESSION['settings']['host'] = reset(array_keys($Settings_Hosts));
+	} else {
+		// we have a valid host, check if the data should be saved 
+		if ($_POST['save'] && isset($_POST['host'])) 
+		{
+			// Changing settings for this MythWeb session
+			if (empty($_POST['host'])) 
+			{
+				// save the image path in the session variable
+				$_SESSION['gallery']['image_path'] 			= $_POST['image_path'];
+				$_SESSION['gallery']['cache_path'] 			= $_POST['cache_path'];
+				$_SESSION['gallery']['default_viewsize'] 	= $_POST['default_viewsize'];
+				$_SESSION['gallery']['screen_width'] 		= $_POST['screen_width'];
+				$_SESSION['gallery']['viewsizes'] 			= $_POST['viewsizes'];
+				$_SESSION['gallery']['valid_image_files'] 	= $_POST['valid_image_files'];
+			} else {
+				// save the settings in the database
+//				setGalleryImagePath( 		$_POST['image_path'], 		$_POST['host'] );
+				setGalleryCachePath( 		$_POST['cache_path'], 		$_POST['host'] );
+				setGalleryDefaultViewSize( 	$_POST['default_viewsize'], $_POST['host'] );
+				setGalleryScreenWidth( 		$_POST['screen_width'], 	$_POST['host'] );
+				setGalleryViewSizes( 		$_POST['viewsizes'], 		$_POST['host'] );
+				setGalleryValidImageFiles( 	$_POST['valid_image_files'],$_POST['host'] );
+			}
+			// Make sure the session host gets updated to the posted one.
+			$_SESSION['settings']['host'] = $_POST['host'];
+		}
+	}
+}
+
+// the absolute path where the images are
+// get it from the database or the session variable 
+function getGalleryImagePath()
+{
+	global $db;
+	if (!empty($_SESSION['settings']['host'])) {		
+		$imagePath = $db->query_col('SELECT data FROM settings 
+			WHERE value="GalleryDir" AND hostname=?', $_SESSION['settings']['host']);
+	} 
+	
+	if (!$imagePath)
+	{
+		$imagePath = _or($_SESSION['gallery']['image_path'], '/myth/gallery');
+	}
+	
+	return $imagePath;
+}
+
+// directory where the cached images are stored
+// this directory is relative to the htdocs directory
+function getGalleryCachePath()
+{
+	global $db;
+	if (!empty($_SESSION['settings']['host'])) {
+ 		$cachePath = $db->query_col('SELECT data FROM settings 
+ 			WHERE value="GalleryCachePath" AND hostname=?', $_SESSION['settings']['host']);
+        }
+        
+        if (!$cachePath)
+        {	
+		$cachePath = _or($_SESSION['gallery']['cache_path'], '/mythweb/data/cache');
+	} 
+	
+	return $cachePath;
+}
+
+
+// defines the default view mode
+// default is 4 columns and 4 rows per page
+function getGalleryDefaultViewSize()
+{
+	global $db;
+	if (!empty($_SESSION['settings']['host'])) {
+		$defaultViewSize = $db->query_col('SELECT data FROM settings 
+ 			WHERE value="GalleryDefaultViewSize" AND hostname=?', $_SESSION['settings']['host']);
+ 	}
+ 	
+ 	if (!$defaultViewSize)
+ 	{
+		$defaultViewSize = _or($_SESSION['gallery']['default_viewsize'], '4,3');
+	} 
+	
+	return $defaultViewSize;
+}
+
+
+// width if the screen-200 (example 1024-200)
+// this is needed to calculate the width of the images
+function getGalleryScreenWidth()
+{
+	global $db;
+	if (!empty($_SESSION['settings']['host'])) {
+ 		$screenWidth = $db->query_col('SELECT data FROM settings 
+ 			WHERE value="GalleryScreenWidth" AND hostname=?', $_SESSION['settings']['host']);
+	}
+	
+	if (!$screenWidth)
+	{	
+		$screenWidth = _or($_SESSION['gallery']['screen_width'], '1024');
+	} 
+	
+	return $screenWidth;
+}
+
+
+// columns and rows that are shown on one page, ; separates another mode
+function getGalleryViewSizes()
+{
+	global $db;
+	if (!empty($_SESSION['settings']['host'])) {
+ 		$viewSizes = $db->query_col('SELECT data FROM settings 
+ 			WHERE value="GalleryViewSizes" AND hostname=?', $_SESSION['settings']['host']);
+        }
+        
+        if (!$viewSizes)
+        {	
+		$viewSizes = _or($_SESSION['gallery']['viewsizes'], '5,4 ; 4,4 ; 4,3 ; 3,3 ; 2,2 ; 1,1');
+	} 
+	
+	return $viewSizes;
+}
+
+
+// image extensions that will be shown, everything else
+// will not work, currently there four are supported
+function getGalleryValidImageFiles()
+{
+	global $db;
+	if (!empty($_SESSION['settings']['host'])) {
+ 		$validImageFiles = $db->query_col('SELECT data FROM settings 
+ 			WHERE value="GalleryValidImageFiles" AND hostname=?', $_SESSION['settings']['host']);
+        }
+        
+        if (!$validImageFiles)
+        {	
+		$validImageFiles = _or($_SESSION['gallery']['valid_image_files'], 'jpg,png,gif,bmp');
+	} 
+	
+	return $validImageFiles;
+}
+
+
+// save the image path in the database 
+//function setGalleryImagePath( $imagePath, $host ) 
+//{
+//	global $db;
+//	$db->query('UPDATE settings SET data = ?
+//		WHERE value="GalleryDir" AND hostname=?', $imagePath, $host);
+//}
+
+function setGalleryCachePath( $cachePath, $host )
+{
+ 	global $db;
+ 	$db->query('UPDATE settings SET data = ?
+ 		WHERE value="GalleryCachePath" AND hostname=?', $cachePath, $host);
+}
+
+
+function setGalleryDefaultViewSize( $defaultViewSize, $host )
+{
+ 	global $db;
+ 	$db->query('UPDATE settings SET data = ?
+ 		WHERE value="GalleryDefaultViewSize" AND hostname=?', $defaultViewSize, $host);
+}
+
+
+function setGalleryScreenWidth( $screenWidth, $host )
+{
+ 	global $db;
+ 	$db->query('UPDATE settings SET data = ?
+ 		WHERE value="GalleryScreenWidth" AND hostname=?', $screenWidth, $host);
+}
+
+
+function setGalleryViewSizes( $viewSizes, $host )
+{
+ 	global $db;
+ 	$db->query('UPDATE settings SET data = ?
+ 		WHERE value="GalleryViewSizes" AND hostname=?', $viewSizes, $host);
+}
+
+
+function setGalleryValidImageFiles( $validImageFiles, $host )
+{
+ 	global $db;
+ 	$db->query('UPDATE settings SET data = ?
+ 		WHERE value="GalleryValidImageFiles" AND hostname=?', $validImageFiles, $host);
+}
+
+
diff -Naur ../mythweb-orig/modules/gallery/init.php ./modules/gallery/init.php
--- ../mythweb-orig/modules/gallery/init.php	1969-12-31 19:00:00.000000000 -0500
+++ ./modules/gallery/init.php	2007-08-19 23:21:33.000000000 -0400
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Initialization routines for the MythWeb Gallery module
+ *
+ * @url         $URL: http://svn.mythtv.org/svn/trunk/mythplugins/mythweb/modules/gallery/init.php $
+ * @date        $Date: 2006-12-19 09:17:33 +0100 (Di, 19 Dez 2006) $
+ * @version     $Revision: 12295 $
+ * @author      $Author: rsiebert $
+ * @license     GPL
+ *
+ * @package     MythWeb
+ * @subpackage  Gallery
+ *
+/**/
+
+// Settings options
+    $Settings['gallery'] = array('name'    => t('Gallery'),
+                                 'choices' => array('prefs'  => t('Preferences'), ),
+                                 'default' => 'prefs',
+                                );
+
+// First, we should check to see that MythGallery is configured.
+    $has_gallery = $_SESSION['locale']
+                    ? true
+                    : $db->query_col('SELECT COUNT(data)
+                                        FROM settings
+                                       WHERE value="locale"');
+
+
+
+// If gallery is enabled, add it to the list.
+    if ($has_gallery) {
+        $Modules['gallery'] = array('path'        => 'gallery',
+                                    'sort'        => 5,
+                                    'name'        => t('Gallery'),
+                                    'description' => t('Local Image Gallery')
+                                   );
+    }
diff -Naur ../mythweb-orig/modules/gallery/set_prefs.php ./modules/gallery/set_prefs.php
--- ../mythweb-orig/modules/gallery/set_prefs.php	1969-12-31 19:00:00.000000000 -0500
+++ ./modules/gallery/set_prefs.php	2007-08-20 22:29:12.000000000 -0400
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Gallery settings
+ *
+ * @url         $URL: http://svn.mythtv.org/svn/trunk/mythplugins/mythweb/modules/gallery/set_prefs.php $
+ * @date        $Date: 2006-12-19 09:17:33 +0100 (Di, 19 Dez 2006) $
+ * @version     $Revision: 12295 $
+ * @author      $Author: xris $
+ * @license     GPL
+ *
+ * @package     MythWeb
+ * @subpackage  Gallery
+/**/
+
+// Load functions
+require_once 'includes/objects/Settings.php';
+
+// Load all of the known mythtv frontend hosts
+$Settings_Hosts = getGalleryHostnames();
+
+// update the values in the database if necessary
+saveGalleryConfig( $Settings_Hosts );
+loadGalleryConfig();
+
diff -Naur ../mythweb-orig/modules/gallery/tmpl/default/gallery.php ./modules/gallery/tmpl/default/gallery.php
--- ../mythweb-orig/modules/gallery/tmpl/default/gallery.php	1969-12-31 19:00:00.000000000 -0500
+++ ./modules/gallery/tmpl/default/gallery.php	2007-08-22 00:21:05.000000000 -0400
@@ -0,0 +1,39 @@
+<?php
+/**
+ * Display template for the Gallery module
+ *
+ * @url         $URL: http://svn.mythtv.org/svn/trunk/mythplugins/mythweb/modules/gallery/tmpl/default/gallery.php $
+ * @date        $Date: 2006-12-19 09:17:33 +0100 (Di, 19 Dez 2006) $
+ * @version     $Revision: 12295 $
+ * @author      $Author: xris $
+ * @license     GPL
+ *
+ * @package     MythWeb
+ *
+/**/
+
+// Page title
+$page_title = 'MythWeb - '.t('Gallery');
+
+// the current viewsize mode
+$image_viewsize = $gallery->getImageViewSize();
+
+// If displaying full size image don't display header and footer
+if ($image_viewsize == 'fullsize') {
+   // Print the gallery part 
+   $gallery->start();
+}
+else
+{
+   // Load this page's custom stylesheet
+   $headers[] = '<link rel="stylesheet" type="text/css" href="'.root.skin_dir.'/gallery.css" />';
+
+   // Print the page header
+   require 'modules/_shared/tmpl/'.tmpl.'/header.php';
+
+   // Print the gallery part 
+   $gallery->start();
+
+   // Print the page footer
+   require 'modules/_shared/tmpl/'.tmpl.'/footer.php';
+}
\ No newline at end of file
diff -Naur ../mythweb-orig/modules/gallery/tmpl/default/set_prefs.php ./modules/gallery/tmpl/default/set_prefs.php
--- ../mythweb-orig/modules/gallery/tmpl/default/set_prefs.php	1969-12-31 19:00:00.000000000 -0500
+++ ./modules/gallery/tmpl/default/set_prefs.php	2007-08-19 23:21:33.000000000 -0400
@@ -0,0 +1,93 @@
+<?php
+/**
+ * Display/save MythGallery settings
+ *
+ * @url         $URL: http://svn.mythtv.org/svn/trunk/mythplugins/mythweb/modules/gallery/tmpl/default/set_prefs.php $
+ * @date        $Date: 2007-01-09 07:37:34 +0100 (Di, 09 Jan 2007) $
+ * @version     $Revision: 12460 $
+ * @author      $Author: xris $
+ * @license     GPL
+ *
+ * @package     MythWeb
+ * @subpackage  Gallery
+ *
+/**/
+
+// Display the gui for the settings
+$galleryConfigTheme = new GalleryConfigTheme();
+$galleryConfigTheme->showConfig();
+
+class GalleryConfigTheme
+{
+	function GalleryConfigTheme()
+	{
+		
+	}
+
+	function showConfig() 
+	{
+		echo '<form class="form" method="post" action="'. form_action .'">'.
+			'<input type="hidden" name="host" value="'. html_entities($_SESSION['settings']['host']) .'"/>'.
+			'<table border="0" cellspacing="0" cellpadding="0">'.
+				'<tr class="_sep">'.
+    				'<td>'.
+						t('Gallery image path').':&nbsp;'.
+					'</td>'.
+		    		'<td>'.
+						'<input class="_text" type="text" name="image_path" value="'.getGalleryImagePath().'">'.
+					'</td>'.
+				'</tr>'.
+				'<tr class="_sep">'.
+    				'<td>'.
+						t('Path where the thumbnails are').':&nbsp;'.
+					'</td>'.
+		    		'<td>'.
+						'<input class="_text" type="text" name="cache_path" value="'.getGalleryCachePath().'">'.
+					'</td>'.
+				'</tr>'.
+				'<tr class="_sep">'.
+    				'<td>'.
+						t('Default view size').':&nbsp;'.
+					'</td>'.
+		    		'<td>'.
+						'<input class="_text" type="text" name="default_viewsize" value="'.getGalleryDefaultViewSize().'">'.
+					'</td>'.
+				'</tr>'.
+				'<tr class="_sep">'.
+    				'<td>'.
+						t('Horizontal screen resolution').':&nbsp;'.
+					'</td>'.
+		    		'<td>'.
+						'<input class="_text" type="text" name="screen_width" value="'.getGalleryScreenWidth().'">'.
+					'</td>'.
+				'</tr>'.
+				'<tr class="_sep">'.
+    				'<td>'.
+						t('List of available view sizes').':&nbsp;'.
+					'</td>'.
+		    		'<td>'.
+						'<input class="_text" type="text" name="viewsizes" value="'.getGalleryViewSizes().'">'.
+					'</td>'.
+				'</tr>'.
+				'<tr class="_sep">'.
+    				'<td>'.
+						t('List of allowed image formats').':&nbsp;'.
+					'</td>'.
+		    		'<td>'.
+						'<input class="_text" type="text" name="valid_image_files" value="'.getGalleryValidImageFiles().'">'.
+					'</td>'.
+				'</tr>'.
+				'<tr>'.
+					'<td align="center">'.
+						'<input class="_button" type="reset" class="submit" value="'.t('Reset').'">'.
+					'</td>'.
+					'<td align="center">'.
+						'<input class="_button" type="submit" class="submit" name="save" value="'.t('Save') .'">'.
+					'</td>'.
+				'</tr>'.
+			'</table>'.
+		'</form>';
+	}
+}
+
+?>
\ No newline at end of file
diff -Naur ../mythweb-orig/modules/gallery/tmpl/default/welcome.php ./modules/gallery/tmpl/default/welcome.php
--- ../mythweb-orig/modules/gallery/tmpl/default/welcome.php	1969-12-31 19:00:00.000000000 -0500
+++ ./modules/gallery/tmpl/default/welcome.php	2007-08-19 23:21:33.000000000 -0400
@@ -0,0 +1,26 @@
+<?php
+/**
+ * Welcome page description of the Gallery module.
+ *
+ * @url         $URL: http://svn.mythtv.org/svn/trunk/mythplugins/mythweb/modules/gallery/tmpl/default/welcome.php $
+ * @date        $Date: 2005-12-13 08:23:18 +0100 (Di, 13 Dez 2005) $
+ * @version     $Revision: 8252 $
+ * @author      $Author: xris $
+ * @license     GPL
+ *
+ * @package     MythWeb
+ *
+/**/
+
+// Open with a div and an image
+    echo '<div id="info_gallery" class="hidden">',
+         '<img src="', skin_url, '/img/gallery.png" class="module_icon" />',
+
+// Print a basic overview of what this module does
+         t('welcome: gallery'),
+
+// Next, print a list of possible subsectons
+    ####
+
+// Close the div
+         "</div>\n";
\ No newline at end of file
diff -Naur ../mythweb-orig/modules/_shared/lang/English.lang ./modules/_shared/lang/English.lang
--- ../mythweb-orig/modules/_shared/lang/English.lang	2007-08-19 23:20:01.000000000 -0400
+++ ./modules/_shared/lang/English.lang	2007-08-19 23:26:41.000000000 -0400
@@ -153,6 +153,7 @@
 "Create Schedule"
 "Current Conditions"
 "Current recordings"
+"Current path"
 "Currently Browsing:  $1"
 "Currently Recording:  Edit"
 "Custom"
@@ -164,6 +165,7 @@
 "Deactivated"
 "Default"
 "Default MythVideo View"
+"Default view size"
 "Delete"
 "delete"
 "Delete $1"
@@ -242,6 +244,8 @@
 "freqid"
 "Friday"
 "Frontends"
+"Gallery"
+"Gallery image path"
 "generic_date"
     %a %b %e, %Y
 "generic_time"
@@ -269,6 +273,7 @@
 "Hide"
 "High"
 "Home"
+"Horizontal screen resolution"
 "Host"
 "Hosted by"
 "Hosts"
@@ -276,6 +281,7 @@
 "Hour Format"
 "hue"
 "Humidity"
+"Images per page"
 "IMDB"
 "imdb rating"
 "IMDBTYPE"
@@ -318,6 +324,8 @@
 "length"
 "Length"
 "Length (min)"
+"List of allowed image formats"
+"List of available view sizes"
 "Listing &quot;Jump to&quot;"
 "Listing Time Key"
 "Listings"
@@ -367,6 +375,7 @@
 "mythvideo.sort_ignores_case"
 "MythWeb"
 "MythWeb Defaults"
+"MythWeb Gallery."
 "MythWeb Global Defaults"
 "MythWeb Session"
 "MythWeb session settings"
@@ -401,6 +410,7 @@
 "Number of shows"
 "Number of Songs"
 "Number of timeslots"
+"of"
 "Only display favourite channels"
 "Only match commercial-free channels"
 "Only match HD programs"
@@ -415,6 +425,7 @@
 "Past Month"
 "Past Week"
 "Past Year"
+"Path where the thumbnails are"
 "Paused"
 "Pending"
 "People"
@@ -673,6 +684,7 @@
 "Subtitles Available"
 "Sunday"
 "Surround Sound"
+"Switch view mode"
 "Tab"
 "The requested recording schedule has been deleted."
 "There are no items in this Playlist!"
@@ -690,6 +702,7 @@
 "Title Match"
 "Title search"
 "Title Search"
+"to"
 "Today"
 "Tomorrow"
 "Too Many"
@@ -784,6 +797,8 @@
 "Wednesday"
 "welcome: backend_log"
     Show the server logs.
+"welcome: gallery"
+	Browse your picture collection.
 "welcome: music"
     Browse your music collection.
 "welcome: remote"
diff -Naur ../mythweb-orig/modules/_shared/lang/German.lang ./modules/_shared/lang/German.lang
--- ../mythweb-orig/modules/_shared/lang/German.lang	2007-08-19 23:20:01.000000000 -0400
+++ ./modules/_shared/lang/German.lang	2007-08-19 23:27:54.000000000 -0400
@@ -209,6 +209,8 @@
 "Create a Random Mix"
 "Create Schedule"
     Speichern
+"Current path"
+    Aktueller Pfad
 "Current Conditions"
     Das aktuelle Wetter
 "Current recordings"
@@ -231,6 +233,8 @@
 "Default"
     Standard
 "Default MythVideo View"
+"Default view size"
+	Standardansicht
 "Delete"
     Löschen
 "delete"
@@ -343,6 +347,10 @@
 "Friday"
     Freitag
 "Frontends"
+"Gallery"
+	Gallerie
+"Gallery image path"
+	Pfad der Bilder
 "generic_date"
     %e.%m.%Y
 "generic_time"
@@ -379,6 +387,8 @@
 "High"
     Max
 "Home"
+"Horizontal screen resolution"
+	Horizontale Bildschirmauflösung
 "Host"
 "Hosted by"
 "Hosts"
@@ -390,6 +400,8 @@
     Farbton
 "Humidity"
     Luftfeuchtigkeit
+"Images per page"
+	Bilder pro Seite
 "IMDB"
     IMDB
 "imdb rating"
@@ -438,6 +450,10 @@
     Dauer
 "Length (min)"
     Dauer (Min.)
+"List of allowed image formats"
+	Liste der erlaubten Bildformate
+"List of available view sizes"
+	Liste der möglichen Ansichten
 "Listing &quot;Jump to&quot;"
     TV Programm &quot;Gehe zu&quot;
 "Listing Time Key"
@@ -502,6 +518,8 @@
 "mythvideo.sort_ignores_case"
 "MythWeb"
 "MythWeb Defaults"
+"MythWeb Gallery."
+     Gallerie
 "MythWeb Global Defaults"
 "MythWeb Session"
 "MythWeb session settings"
@@ -548,6 +566,8 @@
 "Number of shows"
 "Number of Songs"
 "Number of timeslots"
+"of"
+	von
 "Only display favourite channels"
     Nur Favoriten anzeigen
 "Only match commercial-free channels"
@@ -562,6 +582,8 @@
 "Override"
 "Page Down"
 "Page Up"
+"Path where the thumbnails are"
+	Thumbnails speichern unter
 "Part $1 of $2"
     Teil $1 von $2
 "Past Month"
@@ -870,6 +892,10 @@
 "Streaming"
 "Sub and Desc (Empty matches)"
     Untertitel & Beschr. (kein Ergebnis)
+"subfolder"
+	Unterordner
+"subfolders"
+	Unterordner
 "Submit Search"
 "subtitle"
 "Subtitle"
@@ -882,6 +908,8 @@
 "Subtitles Available"
 "Sunday"
     Sonntag
+"Switch view mode"
+    Ansichtsmodus wechseln
 "Surround Sound"
 "Tab"
 "The requested recording schedule has been deleted."
@@ -907,6 +935,8 @@
 "Title search"
 "Title Search"
     Titel Suche
+"to"
+	bis
 "Today"
     Heute
 "Tomorrow"
@@ -1024,6 +1054,8 @@
     Mittwoch
 "welcome: backend_log"
     Backend Log
+"welcome: gallery"
+	Gallerie
 "welcome: music"
     Musik
 "welcome: remote"
diff -Naur ../mythweb-orig/modules/_shared/tmpl/default/header.php ./modules/_shared/tmpl/default/header.php
--- ../mythweb-orig/modules/_shared/tmpl/default/header.php	2007-08-19 23:20:01.000000000 -0400
+++ ./modules/_shared/tmpl/default/header.php	2007-08-19 23:21:33.000000000 -0400
@@ -96,6 +96,13 @@
         </a>
 <?php
       }
+      if ($Modules['gallery']) {
+?>
+        <a id="gallery_link"<?php if ($Path[0] == 'gallery') echo ' class="current_section"' ?> href="<?php echo root ?>gallery" onmouseover="return help_text('<?php echo str_replace("'", "\\'", t('MythWeb Gallery.')) ?>')" onmouseout="return help_text()">
+            <img src="<?php echo skin_url ?>img/gallery.png" width="48" height="48" class="alpha_png" alt="MythGallery" />
+        </a>
+<?php
+      }
 ?>
         <a id="settings_link"<?php if ($Path[0] == 'settings') echo ' class="current_section"' ?> href="<?php echo root ?>settings" onmouseover="return help_text('<?php echo str_replace("'", "\\'", t('Edit MythWeb and some MythTV settings.')) ?>')" onmouseout="return help_text()">
             <img src="<?php echo skin_url ?>img/settings.png" width="48" height="48" class="alpha_png" alt="<?php echo t('Settings') ?>" />
diff -Naur ../mythweb-orig/skins/default/gallery.css ./skins/default/gallery.css
--- ../mythweb-orig/skins/default/gallery.css	1969-12-31 19:00:00.000000000 -0500
+++ ./skins/default/gallery.css	2007-08-19 23:21:33.000000000 -0400
@@ -0,0 +1,108 @@
+img {
+	border: 0px;
+	border-color: #000000;
+}
+
+table.current_path_and_viewsize {
+	margin-top:5px;
+	border:1px solid #626262;
+	padding:5px;
+	width:100%;	
+}
+
+a {
+	color:#000000; 
+	text-decoration:none;
+}
+
+a.header {
+	font-weight:bold;
+	font-style:italic;
+}
+
+a.folderlist {
+	font-style:italic;
+}
+
+td.current_path {
+	text-align:left;
+	width:auto;
+}
+
+td.change_viewsize_text {
+	text-align:right;
+	width:160px;
+}
+
+td.change_viewsize_selection {
+	text-align:right;
+	width:140px;
+}
+
+select.change_viewsize {
+	border:1px solid #323232;
+	background-color: #191c26;
+	color: #FFFFFF;
+}
+
+td.folder_navigation {
+	width:200px;
+	vertical-align:top;
+}
+
+table.folder_navigation {
+	margin-top:5px;
+	border:1px solid #626262;
+	padding:4px;
+	width:100%;	
+}
+
+div.folder_navigation_active {
+	background-color: #224477;
+	border:1px solid #191c26;
+	text-align:left;	
+	padding:4px;
+}
+
+div.folder_navigation {	
+	border:1px solid #191c26;
+	text-align:left;	
+	padding:4px;
+}
+
+td.image_listing {
+	width:auto;
+	vertical-align:top;
+}
+
+table.imagelist_and_navigation {
+	margin-top:5px;
+	margin-left:5px;
+	border:1px solid #626262;
+	padding:5px;
+	width:100%;	
+}
+
+td.image_navigation {
+	text-align:center;
+	vertical-align:middle;
+	width:20%;
+	border-width: 0px;
+}
+
+td.single_image {
+	font-size:9pt;
+	padding:5px;	
+	text-align:center;
+}
+
+img.single_image {
+	padding:7px;
+	border:1px solid #323232;
+}
+
+img.single_image_active {
+	background-color: #224477;
+	padding:7px;
+	border:1px solid #323232;
+}
\ No newline at end of file
diff -Naur ../mythweb-orig/skins/grey/gallery.css ./skins/grey/gallery.css
--- ../mythweb-orig/skins/grey/gallery.css	1969-12-31 19:00:00.000000000 -0500
+++ ./skins/grey/gallery.css	2007-08-19 23:21:33.000000000 -0400
@@ -0,0 +1,107 @@
+img {
+	border: 0px;
+	border-color: #000000;
+}
+
+table.current_path_and_viewsize {
+	margin-top:5px;
+	border:1px solid #626262;
+	padding:5px;
+	width:100%;	
+}
+
+a {
+	color:#000000; 
+	text-decoration:none;
+}
+
+a.header {
+	font-weight:bold;
+	font-style:italic;
+}
+
+a.folderlist {
+	font-style:italic;
+}
+
+td.current_path {
+	text-align:left;
+	width:auto;
+}
+
+td.change_viewsize_text {
+	text-align:right;
+	width:160px;
+}
+
+td.change_viewsize_selection {
+	text-align:right;
+	width:140px;
+}
+
+select.change_viewsize {
+	border:1px solid #323232;
+	background-color: #212121;
+}
+
+td.folder_navigation {
+	width:200px;
+	vertical-align:top;
+}
+
+table.folder_navigation {
+	margin-top:5px;
+	border:1px solid #626262;
+	padding:4px;
+	width:100%;	
+}
+
+div.folder_navigation_active {
+	background-color: #626262;
+	border:1px solid #212121;
+	text-align:left;	
+	padding:4px;
+}
+
+div.folder_navigation {	
+	border:1px solid #212121;
+	text-align:left;	
+	padding:4px;
+}
+
+td.image_listing {
+	width:auto;
+	vertical-align:top;
+}
+
+table.imagelist_and_navigation {
+	margin-top:5px;
+	margin-left:5px;
+	border:1px solid #626262;
+	padding:5px;
+	width:100%;	
+}
+
+td.image_navigation {
+	text-align:center;
+	vertical-align:middle;
+	width:20%;
+	border-width: 0px;
+}
+
+td.single_image {
+	font-size:9pt;
+	padding:5px;	
+	text-align:center;
+}
+
+img.single_image {
+	padding:7px;
+	border:1px solid #323232;
+}
+
+img.single_image_active {
+	background-color: #626262;
+	padding:7px;
+	border:1px solid #323232;
+}
\ No newline at end of file
diff -Naur ../mythweb-orig/skins/grey/settings.css ./skins/grey/settings.css
--- ../mythweb-orig/skins/grey/settings.css	2007-08-19 23:20:00.000000000 -0400
+++ ./skins/grey/settings.css	2007-08-19 23:21:33.000000000 -0400
@@ -94,7 +94,7 @@
 
     #settings .-host {
         text-align:     right;
-        border-bottom:  2px solid #eee;
+        border-bottom:  2px solid #aaa;
     }
 
 /* A notification/warning */
@@ -115,3 +115,33 @@
         border:             2px solid #999;
         border-top:         none;
     }
+
+	#settings ._content input._text {
+		margin:				2px;
+		padding:			2px;
+		border:             1px solid #333333;
+	}
+
+	#settings ._content input._button {
+		margin:				2px;
+		padding:			2px;
+		border:             1px solid #333333;
+		color:				#DDDDDD;
+	}
+
+    #settings ._content table {
+        width:              100%;
+    }
+    #settings ._content table th, #settings ._content table td {
+        padding:            .5em;
+    }
+
+    #settings ._content th, #settings ._content td {
+        text-align:         right;
+        font-weight:        normal;
+        white-space:        nowrap;
+    }
+
+    #settings ._content tr._sep th, #settings ._content tr._sep td {
+        border-bottom:      1px solid #304943;
+    }