1 |
<?php |
1 |
<?php |
2 |
|
2 |
|
3 |
/** |
3 |
/** |
4 |
* Use this script to batch generate all main and preview thumbnails for all |
4 |
* Use this script to batch generate all main and preview thumbnails for all |
5 |
* galleries. Galleries which contain sub-galleries are skipped as are hidden |
5 |
* galleries. Galleries which contain sub-galleries are skipped as are hidden |
6 |
* galleries. |
6 |
* galleries. |
7 |
* |
7 |
* |
8 |
* Currently this is a bit of a hack. Hopefully a later version of the script |
8 |
* Currently this is a bit of a hack. Hopefully a later version of the script |
9 |
* will be built more robustly using the singapore class to greater advantage. |
9 |
* will be built more robustly using the singapore class to greater advantage. |
10 |
* |
10 |
* |
11 |
* @author Tamlyn Rhodes <tam at zenology dot co dot uk> |
11 |
* @author Tamlyn Rhodes <tam at zenology dot co dot uk> |
12 |
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License |
12 |
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License |
13 |
* @copyright (c)2004-2005 Tamlyn Rhodes |
13 |
* @copyright (c)2004-2005 Tamlyn Rhodes |
14 |
* @version 0.1 |
14 |
* @version 0.1 |
15 |
*/ |
15 |
*/ |
16 |
|
16 |
|
17 |
//relative path to the singapore base installation |
17 |
//relative path to the singapore base installation |
18 |
$basePath = '../'; |
18 |
$basePath = '../'; |
19 |
|
19 |
|
20 |
//remove the built in time limit |
20 |
//remove the built in time limit |
21 |
set_time_limit(0); |
21 |
set_time_limit(0); |
22 |
|
22 |
|
23 |
// require main class |
23 |
// require main class |
24 |
require_once $basePath."includes/singapore.class.php"; |
24 |
require_once $basePath."includes/singapore.class.php"; |
25 |
|
25 |
|
26 |
//create singapore object |
26 |
//create singapore object |
27 |
$sg = new Singapore($basePath); |
27 |
$sg = new Singapore($basePath); |
28 |
|
28 |
|
29 |
function showAllThumbnails(&$sg, &$gal) |
29 |
function showAllThumbnails(&$sg, &$gal) |
30 |
{ |
30 |
{ |
31 |
echo "<li>Entering <code>".$gal->name()."</code></li>\n"; |
31 |
echo "<li>Entering <code>".$gal->name()."</code></li>\n"; |
32 |
echo "<ul>\n"; |
32 |
echo "<ul>\n"; |
33 |
echo "<li>".$gal->thumbnailHTML()."</li>\n"; |
33 |
echo "<li>".$gal->thumbnailHTML()."</li>\n"; |
34 |
|
34 |
|
35 |
if($gal->isGallery()) { |
35 |
if($gal->isGallery()) { |
36 |
foreach($gal->galleries as $subgal) |
36 |
foreach($gal->galleries as $subgal) |
37 |
showAllThumbnails($sg, $sg->io->getGallery($subgal->id, $gal)); |
37 |
showAllThumbnails($sg, $sg->io->getGallery($subgal->id, $gal)); |
38 |
} else |
38 |
} else |
39 |
foreach($gal->images as $img) |
39 |
foreach($gal->images as $img) |
40 |
echo "<li>".$img->thumbnailHTML().$img->thumbnailHTML("","preview")."</li>\n"; |
40 |
echo "<li>".$img->thumbnailHTML().$img->thumbnailHTML("","preview")."</li>\n"; |
41 |
|
41 |
|
42 |
echo "</ul>\n"; |
42 |
echo "</ul>\n"; |
43 |
|
43 |
|
44 |
} |
44 |
} |
45 |
|
45 |
|
46 |
?> |
46 |
?> |
47 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
47 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
48 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
48 |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
49 |
|
49 |
|
50 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
50 |
<html xmlns="http://www.w3.org/1999/xhtml"> |
51 |
<head> |
51 |
<head> |
52 |
<title>batch thumbnail generator</title> |
52 |
<title>batch thumbnail generator</title> |
53 |
<link rel="stylesheet" type="text/css" href="tools.css" /> |
53 |
<link rel="stylesheet" type="text/css" href="tools.css" /> |
54 |
</head> |
54 |
</head> |
55 |
|
55 |
|
56 |
<body> |
56 |
<body> |
57 |
|
57 |
|
58 |
<h1>Generating thumbnails</h1> |
58 |
<h1>Generating thumbnails</h1> |
59 |
|
59 |
|
60 |
<?php |
60 |
<?php |
61 |
//start recursive thumbnail generation |
61 |
//start recursive thumbnail generation |
62 |
showAllThumbnails($sg, $sg->gallery); |
62 |
showAllThumbnails($sg, $sg->gallery); |
63 |
?> |
63 |
?> |
64 |
|
64 |
|
65 |
<p>All done! <a href="index.html">Return</a> to tools.</p> |
65 |
<p>All done! <a href="index.html">Return</a> to tools.</p> |
66 |
|
66 |
|
67 |
</body> |
67 |
</body> |
68 |
</html> |
68 |
</html> |