2012-11-30 3 views
2

앨범 이름으로 Picasa 웹 앨범에 액세스하는 데 문제가 있습니다. 앨범 이름이 'My Test Album'입니다. 내가 오류 수신 (공백 포함)이 이름을 사용하는 경우 : 공간 'MyTestAlbum'없이앨범 이름으로 사진을 얻는 방법 Picasa 및 Zend GData PHP

Fatal error: Uncaught exception 'Zend_Uri_Exception' with message 'Invalid URI supplied'

을 잘 작동 :

// Construct the query      
$query = $this->photos->newAlbumQuery(); 
$query->setUser("default"); 
$query->setAlbumName("MyTestAlbum"); //This works fine 

이 발생 오류 :

// Construct the query      
$query = $this->photos->newAlbumQuery(); 
$query->setUser("default"); 
$query->setAlbumName("My Test Album"); // This causes error 

내 질문에 어떤 문자가 허용되지 않으므로 setAlbumName()을 호출하기 전에 문자를 제거 할 수 있습니까?

또는 더 나은 접근 방법에 대한 제안 사항은 무엇입니까?

감사 이안

답변

0

에만 특정 이름과 일치 앨범의 목록을 얻을 수 있습니다 :이 시점에서

// Find the album for the given accountId. 
$albumQuery = $picasa->newAlbumQuery(); 
$albumQuery->setUser($user); 
$albumQuery->setAlbumName("AlbumName"); // No spaces. 
$albumQuery->setMaxResults(1); 

$albumId = null; 

try { 
    $albumFeed = $picasa->getAlbumFeed($albumQuery); 

    foreach($albumFeed as $key => $entry) { 
    $albumId = $entry->getGphotoAlbumId(); 
    } 
} 
catch(Zend_Gdata_App_Exception $ex) { 
    // Create the album because the album name could not be found. 
    $albumId = $this->createAlbum($picasa, "AlbumName"); 
} 

, $albumId 유효한 앨범을 참조해야합니다.

코드는 앨범 피드를 반복합니다. 앨범 이름을 고유하게 식별해야합니다. 그렇지 않으면 코드는 이름과 일치하는 여러 앨범을 반환합니다.

앨범을 삭제 한 다음 같은 이름의 앨범을 다시 만들면 해당 앨범을 검색 할 수없는 버그가 있습니다. 참조 : List recreated album names that were previously deleted.

관련 문제