« Back to zenphoto.org

ZenphotoHacks: loadAlbums.php

File loadAlbums.php, 1.1 kB (added by sbillard, 1 year ago)

php page to regenerate thumbnails in cache

Line 
1 <html>
2 <?php
3 require_once("template-functions.php");
4
5 global $_zp_gallery;
6 $count = 0;
7
8 function loadAlbum($album) {
9   global $_zp_current_album;
10   echo "<br/>Processing " . $album->name . "\n";
11   $subalbums = $album->getSubAlbums();
12   foreach ($subalbums as $folder) {
13     $subalbum = new Album($album, $folder);
14     $count = $count + loadAlbum($subalbum);
15     }
16  
17   $_zp_current_album = $album;
18   if (getNumImages() > 0) {
19     echo "<br/>\n";
20     while (next_image()):
21       echo '<img src="'.getImageThumb().'" height="8" width="8" /> | <img src="'.getDefaultSizedImage().'" height="20" width="20" />' . "\n";
22       $count++;
23       endwhile;
24     }
25   echo "<br/>Finished with " .$album->name . "\n";
26   return $count;
27 }
28 if (isset($_GET['album'])) {
29   $folder = strip($_GET['album']);
30   $album = new Album($album, $folder);
31   $count = loadAlbum($album);
32 } else {
33   echo "Processing Gallery\n";
34   $albums = $_zp_gallery->getAlbums();
35   foreach ($albums as $folder) {
36     $album = new Album($album, $folder);
37     $count = $count + loadAlbum($album);
38     }
39 }
40 echo "<br/>Finished: Total of $count images.<br /><br />";
41 ?>
42 <html>
43
44
45
46