Manual thumbnail/cache creation

All.

I have been playing with zenphoto for quite a while and I think it's simply the best around.

I have set up a fairly large private gallery on a very small server at home. I have several 1000's of photos there, and the thumbnail/cache generation is taking far too long on my poor little server. (It being small is not an issue since I will have a max of 2 clients connected at the same time).

What I would like to do is create the thumbnails / cache manually on the command line instead of having the overhead of Apache/PHP/etc creating them.

I have had a (very) brief look at the code, but I can not figure out if the code depends on anything else than the filename in the cache directory. Does it expect certain attributes like quality or timestamps? (or anything else for that matter). The size of the thumbnail is obviously a fixed requirement.

Have anyone else done something like this before? If so, do you still have script/command snippets hanging around?

Any hints, tips or examples would be greatly appreciated.

PS. I am planning to set up some sort of semi-automated release system where photos from the above gallery is "released" (pushed) out to my public server when äuthorised. This server is well fast enough, but if I could find a way to not have to re-generate the cache it would make the automation a lot smoother.

Thanks in advance.
Tor

Comments

  • There is a link on each album to pre-cache images. (There is also one for the gallery, but given your description of server performance, I don't recommend you use it.) That link will cause default sized images and thumbnails to be created and stored in the cache folder. Once created, the thumbs and images are just fetched from the cache.
  • As far as I can see, the pre-cache images link creates a single page with all the required images for that album (or gallery) - and then creates/updates them as your browser requests them. I'd be more interested in a page that creates all the cache files on the server *without* having to download them locally. Is there an option already or would there be a feasable hack?
    (I'm thinking maybe making a function out of the contents of i.php, and calling it on each image but only displaying, say, a progress dot instead of downloading each image. I could also call this on upload.)
  • I am familiar with the pre-cache link, and fantastic work on that one by the way.

    Due to my "unique" situation I was just wondering if there are any way I can manually create these myself. I am an old-school unix sysadmin, and I am more comfortable on the command line.

    Does the application have any dependencies on how the images are created? Could I simply use the convert utility that is part of ImageMagick to convert them to a smaller size?

    I am not trying to dis the pre-cache functionality, but in some cases you may want to optimise the cache creation process a bit. At this point in time it is simply because my server is not really able for it (I could divide them into sub-albums, but that is too much of manual labour for me).
    This also holds true to a certain extent when I in the not so distant future want to send large parts of my images in my gallery to my co-lo server. I don't really want to spend days pre-caching thousands of images manually before I can use it. Not only because of the time and effort involved, but also due to the bandwith involved (as jlang elegantly mentions above).

    I would like to create some sort of script that will walk through my gallery directories and creates the cache images.

    I will try to have a go at reading the code, and then test if this can be done. I will try to respond with my progress (If any).
  • trisweb Administrator
    It's very possible to create a command-line PHP script that will do the same thing as the pre-cache script. It can make system calls to fork PHP i.php processes to do the processing.

    Also, it's possible to make the same request through a browser *without* downloading each image. It would require a change to `i.php` to return a simple text response when the image generation is complete for the requested image. The requesting HTML page would request images via JavaScript and display progress as it finishes, but no images would be downloaded.

    Both of these methods would be fun to write... I may give them a shot. tbendiksen, if you make any progress keep us posted.
  • acrylian Administrator, Developer
    Isn't that what our current cache scripts do? Couldn't we just modify the scripts to not showing the images while caching?
  • Pretty much - the only real issue is that there's no way to call the resize stuff in i.php without getting an image back.

    tbendiksen's issue is slightly different - if the server is too slow or can't handle the resize, not downloading the results won't really make any difference. Imagemagick may be more efficient than the php libraries.
  • Excellent stuff lads.

    My particular case is probably a not very common one, so I will look into the ImageMagick route.

    I do really believe that replacing the images with either text or a small static image would be very beneficial. Also in my secondary case described above where I will transfer a lot of images to a new server. While this server is fast it will take a lot of bandwith to cache the images.

    Thanks everyone for the input. If I come up with anything usable I will post back.

    --
    Tor
Sign In or Register to comment.