How to change location of albums folder?

I'd like to specify another location for the albums folder.
Is there a variable somewhere that I could change (e.g. change "/albums" to "/anotherfolder")? Could it be added to zp-config.php?

Comments

  • trisweb Administrator
    It should be in the file `class-gallery.php` as the variable $albumdir, set in the constructor on line 17, but I believe it's also hardcoded in several other places, like i.php and link paths in functions.php. Just do a global search for "/albums/" and you might be able to change them all where appropriate.
  • Sorry to revive this thread... Any hope to un-hardcode the albums path? I run a server myself and I rather have the albums not in the webroot.
  • Oh My!

    It is hard coded in: (line numbers are from the community build)
    admin.php (lines 16 & 188)
    class-album.php (lines 9, 26, 244, 249, 394, 441)
    class-gallery.php (lines 18 & 274)
    class-image.php (lines 30, 31, 32, 47, 252)
    functions.php (line 193)
    admin-functions.php (line 88)
    i.php (lines 73, 80, 181)

    Fixing this should probably be put on the roadmap.
  • Indeed. I managed to implement it in the first community build release but with so many updates, it made it impossible to keep track of it.
  • jordi-kun, if you get it implemented again please make the diff or patch files and we can get it implemented if it is quality.
  • Jordi-kun: I have a preliminary patch that fixes all the hard code "/albums/" to calls on the function `getAlbumFolder()` which I will be releasing soon. So, all that is left is to to the actual option / conf stuff. The implementation I have made will use whatever you put in `conf['album_folder']` in zp-config. If there is no such item it defaults to the classic "/album/".
  • trisweb Administrator
    Excellent. Thanks Stephen. Post on trac as usual!
  • It is there now--had to test it first :)http://www.zenphoto.org/trac/ticket/116

    This allows, but does not implement changing the album folder name. That I did not wish to test.
  • @sbillard: thanks! Since it is using SERVERPATH.getAlbumFolder(), it doesn't look like you can set the albums folder outside the zenphoto folder. I haven't tried it yet though, will do this afternoon.

    maybe the getAlbumFolder function could return the also the SERVERPATH if required.
  • I have a new set of changes on the ticket. However, there is still an issue you will have to deal with. Sometimes it uses SERVERPATH (now the default) and sometimes it uses WEBPATH or another path. YOu have to figure out what to do about those.

    The new function is passed the root path and returns the full path. Kind of like you suggest.
  • Thanks sbillard, so far looks good! One thing I saw, which I'm not sure if it's related or not, is that the cached images all go to the /cache folder instead of their respective subfolders.
  • I'll have to look into this. I didn't think I changed anything having to do with the cache.
  • @sbillard: I found the "what" but not the "why". In functions.php, function getImageCacheFilename(), there is the following line:

    `if ($album='') { $albumsep = ''; }`

    if you comment it, cache works perfect. I'm not sure why it was added thus ignore possible consequences.
  • Yes, I found that myself today. I also don't know why it causes the problem, but I will delete that line in my next update. Thanks for letting me know, though. Wish I'd looked at the forum before working on the problem all day today!
  • what about the cache folder? should it be un-hardencoded?
  • That sounds like a good idea for a trac ticket.
  • There is already a ticket.
Sign In or Register to comment.