How do I make Gallery use an existing image tree?

frowbie

Joined: 2003-12-14
Posts: 6
Posted: Sun, 2003-12-14 21:51

I have just installed Gallery and it's awesome. Unfortunately I couldn't find an explanation on how to use my old image tree. I have an existing gallery with a recursive tree of images. All I want to do is port this to Gallery. If I have to re-enter all the descriptions that's okay (though not great), but I do need to keep the images at their original destinations.

So, I have two (hopefully) simple questions:
1) How do I tell Gallery to use the existing location (on the same server, account, etc.)?
2) When I add new images, how do I tell it to use a relative path on the server?

My old gallery is at ilivenow.com/gallery and my test Gallery is at ilivenow.com/test/gallery

Very simply, my gallery is travel photos sorted by continent, then country, then city, etc.

Thanks!!!
Matt

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Wed, 2003-12-17 17:36

Of these methods:
http://gallery.menalto.com/modules.php?op=modload&name=phpWiki&file=index&pagename=Other%20methods

I think that only galleryadd.pl (a perl script) will do the job for you.

 
attorney

Joined: 2003-12-22
Posts: 4
Posted: Mon, 2003-12-22 07:58
jmullan wrote:
Of these methods:
http://gallery.menalto.com/modules.php?op=modload&name=phpWiki&file=index&pagename=Other%20methods

I think that only galleryadd.pl (a perl script) will do the job for you.

I tried galleryadd.pl and received error 413 for all larger images. Does anyone know why? I am in the process of writing a shell script that traverses a directory structure, invokes a custom PHP file I wrote which simply invokes the createalbum util.php command with the current directory name, and then calls galleryadd.pl to insert all of the pictures in the directory into the newly created album.

This trick seems to work, except that larger images, e.g., > 800K or so give an HTTP 413 error. Apparently my RH 9 Apache has some problem with my solution. I don't know if it is a problem with my script or with galleryadd.pl. I am not really a PHP programmer, nor a Perl programmer, so I cannot easily debug.

If anyone has any thoughts on this, let me know.

Thanks!
-Steve

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Mon, 2003-12-22 08:16

Steve, I'm not sure why you aren't just using galleryadd.pl's recursive album creation abilities.

the 413 error is probably a result of having something set incorrectly in Apache. Can you upload those images through the regular web interface?

 
attorney

Joined: 2003-12-22
Posts: 4
Posted: Tue, 2003-12-23 21:25

Thanks for replying. I did not know about the recursion until after more spelunking through the code.

I found that gallery did not handle some directory names well that galleradd.pl creates in the gallery. I am attaching a script that lets me point the script at a top level directory and have subdirectories created automatically for me using galleryadd.pl, but with corrected names for the directories.

I've commented the script. There are probably better ways to do this (just let me know!). I'd like a proper mini-php program I could call to create a new top level album. This way I would use it to create an album (if needed) for the directory passed to the script and direct galleryadd.pl to create/insert the sub-albums as currently done in the script. If you have such a tiny php program, let me know. Thanks!

-Steve

 
paour
paour's picture

Joined: 2002-08-14
Posts: 1479
Posted: Wed, 2003-12-24 08:05

The Gallery Remote protocol contains support for creating albums (including top-level).

 
jmullan
jmullan's picture

Joined: 2002-07-28
Posts: 974
Posted: Wed, 2003-12-24 20:31

It is a silly failing of galleryadd.pl that I haven't figured out how to add albums to the root level yet. It's on the list somewhere.

 
attorney

Joined: 2003-12-22
Posts: 4
Posted: Thu, 2004-01-01 01:57
jmullan wrote:
It is a silly failing of galleryadd.pl that I haven't figured out how to add albums to the root level yet. It's on the list somewhere.

Well, it seems a nice script nonetheless. I thought my wrapper script to walk through subdirectories was a neat solution to the lack of a top level.

 
laklare

Joined: 2006-05-15
Posts: 1
Posted: Mon, 2006-05-15 05:29

I gave up on getting your script to work in Bash. I think the more elegant way of solving this problem is to find the line that says:
"if ($gallery_resp_text =~ /album_name=([0-9]+)/) {"

and change it to:
"if ($gallery_resp_text =~ /album_name=(.+)/) {"

I'm not sure why the script author searched for the name of the successfully created album and then assigned the album name to only the first contiguous string of numerals in the album name. I think that's a bug. If you set it to "." instead of [0-9], it will set the album name properly and you won't be uploading all your images into the root of /gallery/albums (which happens when gallery can't find an album with the name you gave it).

Works great for me so far for recursive additions.

You may also want to comment out
while (AlbumExists ($newAlbumName)) { #ML: why not use existing directory?
$newAlbumName = $cleanAlbumName . '_' . $i;
$i++;
}
because it prevents you from adding new images to an existing album with the same name (it makes a new album instead.

You could also comment out: "$NewTitle =~ s/[-_]/ /g;" because - and _ are acceptable gallery characters in a gallery title. Well, maybe just get rid of the - part because otherwise you may have trouble representing a date as a gallery title (1998-1-3) turns into (1998 1 3).

Good luck.