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