Adding photos via Gallery2 API to gallery embeded with Drupal

Nexus7
Nexus7's picture

Joined: 2007-06-06
Posts: 5
Posted: Thu, 2007-09-06 15:13

I'm writing script for import photos from flickr. It recieves flickr photo id via ajax and uploads photo to gallery. I have problems with adding photo to DB. I'm initializing gallery via GalleryEmbed::init($params), $gallery object created succesfuly, all required fields are filled. Then I get photo from flickr, upoad it to server (tmp file are really created). Further code below:

<code>
$lock = GalleryCoreApi::acquireWriteLock($g2id);
list ($ret, $newItem) = GalleryCoreApi::addItemToAlbum($tmpFile,
$fileName,
$title,
$summary,
$description,
$mimeType,
$g2id);

GalleryCoreApi::releaseLocks($lock);

$lock = GalleryCoreApi::acquireWriteLock($newItem->getId());

$newItem->setKeywords($tags);
$newItem->save();

print_r($newItem);

GalleryCoreApi::releaseLocks($lock);

@unlink($tmpFile);

<code>

galleryPhotoItem object is printed with all required fields - id, owner, parentId etc. There no error messages in $ret. But there any data are stored to DB :( May be problem is in save() method, but script doesn't terminates... Help me resolving this problem plz...


Gallery version (not just "2"): 2.2.2
PHP version (e.g. 5.1.6): 4.3.11
PHPInfo Link (see FAQ): http://visarts.de/figures/1/gallery2/info.php
Webserver (e.g. Apache 1.3.33): 1.3.33
Database (e.g. MySql 5.0.32): 5.0.18
Activated toolkits (e.g. NetPbm, GD):
Operating system (e.g. Linux): Linux
Browser (e.g. Firefox 2.0): all

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2007-09-06 16:01

- topic moved to the drupal integration forums.
- did you notice g2's flickr import module? downloads -> user contributions. i guess its name is gallery2flickr.

--------------
Documentation: Support / Troubleshooting | Installation, Upgrade, Configuration and Usage

 
Nexus7
Nexus7's picture

Joined: 2007-06-06
Posts: 5
Posted: Thu, 2007-09-06 16:24

gallery2flickr is not stable (as for me) and I need absolutely different interface... My code is based on this module