High volume servers

Anyone else have any ZP setups with a lot of pictures? I'm almost up to 7000 pictures in about 60 albums. With so many pictures and albums pre-caching takes so long it's actually crashed safari because of memory problems, hehe.

Comments

  • I just used cache-images.php as an example. It runs real damn fast now but I haven't tested it enough. I called it "cache_em_all" , make sure its in your zp-core directory and don't forget to chmod u+x so you can run it.

    EDIT: i just noticed that the forum killed all my escapes. :( LINK: http://zp.damnit.org/zp-core/cache_em_all.txt

    `

    #!/usr/bin/php

    <?php<br />
    define('OFFSET_PATH', true);

    require_once("template-functions.php");

    require_once("admin-functions.php");

    function loadAlbum($album) {

    global $_zp_current_album;

    $subalbums = $album->getSubAlbums();

    foreach ($subalbums as $folder) {

    $subalbum = new Album($album, $folder);

    $count = $count + loadAlbum($subalbum);

    }

    $_zp_current_album = $album;

    if (getNumImages() > 0) {

    echo "n" . $album->name . " {";

    while (next_image(true)) {

    $tn = getImageThumb();

    $pic = getDefaultSizedImage();

    if ($tn) { print "."; } else { print "x"; }

    if ($pic) { print "."; } else { print "x"; }

    $count++;

    }

    echo "}n";

    }

    return $count;

    }

    global $_zp_gallery;

    $count = 0;

    $gallery = new Gallery();

    echo "nnRefreshing cache for Galleryn";

    $albums = $_zp_gallery->getAlbums();

    foreach ($albums as $folder) {

    $album = new Album($album, $folder);

    $count = $count + loadAlbum($album);

    }

    echo "nnFinished: Total of ".number_format($count)." images.n";

    ?>

    `
  • Thanks for the links acrylian. I didn't think there where any limitations on pictures or albums though. It's just that loading over 12,000 images on a single page when trying to pre-cache everything on a site like mine poses problems. Pre-caching from a shell worked like magic and was about 1000x faster.
  • acrylian Administrator, Developer
    Alright, probaly I read a little to fast. Loading 12.000 image to cache at once would be probably too much for most servers or will at least take very long time..:-)
    If you found another way from the shell that works better for even better.
  • I wrote and posted a PHP shell script that pre-caches all your images in all albums from the command line. It doesn't delete the existing thumbnails because thats what works well for me. See my 2nd post for the link, i added .txt to the end to make it browser safe.
Sign In or Register to comment.