|Posted: Thu, 2007-08-09 16:08|
My task is the import of Album- and Picture-data into an existing Gallary2-System.
I have to migrate about 5500 Pictures residing in about 500 albums (including description, title, and keywords for both the pictures and the albums) from about 40 users from an external database to this embeded Gallery2-System.
For the external database there was no documentation, but the structure was simple so writing a programm that runs through the data of each user, checking the albums and getting the pictures was (more or less) a straight forward job. So what I have now is a program that runs through my 'Source'-Database and has two entry-Points: One entry point when the Album changes, and One entry for each Picture.
My first aproach was to reverse engineer the gallery2 data-structure of the MySql database and writing directly to the database. (bad idea, as I know now). I ended up having to fill 16 tables, spend about 30 hours, succeeded for the Albums but failed for the Pictures.
So now I am having a try with the API:
GalleryCoreApi::addItemToAlbum( $fileName, $itemName, $title, $summary, $description, $mimeType, $albumId) GalleryCoreApi::createAlbum( $parentAlbumId, $name, $title, $summary, $description, $keywords)
These functions sound like they are exactly what I need.
My Problem ist, that I do not quite understand why I get an error message when I try to switch the user from the admin user to the user, with the user-id in the g2_User table.
Error (ERROR_MISSING_OBJECT) : 2147 GalleryUser * in modules/core/classes/helpers/GalleryEntityHelper_simple.class at line 124 (gallerycoreapi::error) * in modules/core/classes/GalleryCoreApi.class at line 2290 (galleryentityhelper_simple::loadentitybyexternalid) * in modules/core/classes/GalleryEmbed.class at line 215 (gallerycoreapi::loadentitybyexternalid) * in modules/core/classes/GalleryEmbed.class at line 120 (galleryembed::checkactiveuser) * in /usr/www/users/photop2/tkl_import/wrapper_main.php at line 56 (galleryembed::init) * in /usr/www/users/photop2/tkl_import/wrapper_main.php at line 18
What can I do?