// We use the AlbumQuery class to generate the URL for the album
$albumQuery = $gp->newAlbumQuery(); #new Zend_Gdata_Photos_AlbumQuery
$albumQuery->setUser($username);
$albumQuery->setAlbumName('MySpecialAlbum'); # slug
#$albumQuery->setType('entry');
try {
$albumEntry = $gp->getAlbumEntry($albumQuery);
} catch (Zend_Gdata_App_Exception $e) {
if (strpos($e->getMessage(), 'No album found') !== false) {
# create album
$entry = new Zend_Gdata_Photos_AlbumEntry();
$entry->setTitle($gp->newTitle('My Special Album'));
$entry->setSummary($gp->newSummary('Description my album'));
$createdEntry = $gp->insertAlbumEntry($entry);
$albumEntry = $createdEntry;
} else {
return false;
}
}
Title:
PHP - Zend Gdata Photo Create album if not exist
Description:
// We use the AlbumQuery class to generate the URL for the album $albumQuery = $gp->newAlbumQuery(); #new Zend_Gdata_Photos_AlbumQuery ...
...
Rating:
4