First of all: thankyou for zenphoto! It's quick, it's uncomplicated and it does it's job! Don't add too much extras and I luv you forever.
I had gallery2 running and it was a pain. Much too huge and hard to understand, when you needed to tweak it.
I wrote this perl script to import the image description from within gallery. Use at your own risk and only, if you know what you're doing:
---snip---
##############################################################################
use DBI();
$user = "xxx";
$password = "xxx";
$dbh = DBI->connect("DBI:mysql:database=xxx;host=localhost", "$user", "$password",
{'RaiseError' => 1});
$counter = 0;
%UMLAUTE = ( 'Ä' => 'Ae', 'Ö' => 'Oe', 'Ü' => 'Ue','ä' => 'ae', 'ö' => 'oe', 'ü' => 'ue', 'ß' => 'ss');
@UMLKEYS = join("|", keys(%UMLAUTE));
$cursor = $dbh->prepare("select gallery2_FileSystemEntity.g_id, gallery2_FileSystemEntity.g_pathComponent, gallery2_Item.g_description from
gallery2_FileSystemEntity, gallery2_Item where gallery2_FileSystemEntity.g_id = gallery2_Item.g_id;") || die "Prepare schiefgegangen ($DBI::errstr)";
$cursor->execute() || die "Query schiefgegangen ($DBI::errstr)";
while(defined(my $row = $cursor->fetch))
{
$id = $row->[0];
$datei = $row->[1];
$besch = $row->[2];
$besch =~ s/(@UMLKEYS)/$UMLAUTE{$1}/g;
$besch = $dbh->quote($besch);
$datei = $dbh->quote($datei);
my $statement = "UPDATE zen_images SET title = $besch WHERE filename = $datei";
$dbh->do("$statement");
$counter++;
print "$counter: $datei --- $besch\n";
select(undef, undef, undef, 0.2); ## wait 200 ms for the database
}}
}
exit(0);
---snap---
It's intended to run in the shell, so don't try to call it from a browser. And check, if the queries work with your database, before you try.
Might help someone get rid of Gallery2!
Just a few tips if you're using this:
This script assumes that you're putting zenphoto in the same database as Gallery. If yours is in a different database, simply define a second database conection and send the update statement to the new database:
`
$dbh2 = DBI->connect("DBI:mysql:database=xxxx;host=localhost", "$user", "$password",{'RaiseError' => 1});
my $statement = "UPDATE zp_images SET title = $besch WHERE filename = $datei";
$dbh2->do("$statement");
`
My databases both use the same usernames and passwords. if yours are different you'd need to define new variables for those as well.
inspired by this tool, I have wrote the migrator for gallery2 to zenphoto. http://apps.ouwu.com/confluence/display/pb/Gallery2+to+ZenPhoto+Migrator
That migrator didn't work for me - the image descriptions didn't copy over.
After running it I realized that the perl script above didn't work either. My husband ended up writing a sql statement that works:
`
UPDATE zendatabase.zp_images im
INNER JOIN gallerydatabase.g2_FileSystemEntity fse ON im.filename=fse.g_pathComponent
INNER JOIN gallerydatabase.g2_Item item ON fse.g_id=item.g_id
INNER JOIN gallerydatabase.g2_ChildEntity ce ON item.g_id=ce.g_id
INNER JOIN zendatabase.`zp_albums zp_albums ON im.albumid=zp_albums.id
INNER JOIN (SELECT g_id, REPLACE(REPLACE(g_title, '"', '"'), '&', '&') galltit FROM gallerydatabase.g2_Item WHERE g_canContainChildren=1) AS g_album ON ce.g_parentId=g_album.g_id
SET im.desc = item.g_summary
WHERE g_album.galltit=zp_albums.title
Replace the gallerydatabase and zendatabase with the correct database names. ALso check the table prefixes and change them to match yours.
Went through this process recently. After Googling around for a solution, I mashed together several partial solutions and came up with a Frankenstein script that does most of the heavy lifting for you. The script is posted on my website at http://www.bogen.org/2012/05/07/gallery2-to-zenphoto-migration/
Great, I have put an entry on our extensions section:
http://www.zenphoto.org/news/gallery2-to-zenphoto-migration
If we may ask why did you choose Zenphoto against for example the newer Gallery3?