2017-04-12 6 views
0

이미지를 다운로드하려고 애 쓰고, 나는 다음과 같은 코드가 있습니다CMIS를 사용하여 Alfresco 저장소에서 이미지를 어떻게 다운로드합니까? "<em>루트/폴더 1/Folder2 폴더/image.jpg를</em>" <p></p> 내가 업로드 부분을 해결하기 위해 관리하지만 난 : 나는 구조 다음 프레스코 저장소에 업로드 및 다운로드 이미지가 시스템과 함께 일하고 있어요

if(!empty($path)) { 
    $path = $this->_clientCMIS->getObjectByPath('/'.$path); 
    $path = ' AND IN_FOLDER(\''.$path->id.'\')'; 
} 
$query = 'SELECT * FROM cmis:document WHERE cmis:name = \''.$file.'\''.$path; 
$documents = $this->_clientCMIS->query($query); 
foreach ($documents->objectList as $document) { 
    $data = explode(':', $document->uuid); 
    array_push($response['data'], array(
     'id' => $document->properties['cmis:objectId'] 
     , 'path' => (isset($document->properties['cmis:path']))?$document->properties['cmis:path']:'' 
     , 'name' => $document->properties['cmis:name'] 
     , 'url' => 'http://'.$this->_ip.$this->_port.'/share/proxy/alfresco/api/node/content/workspace/SpacesStore/'.$data[2].'/'.$document->properties['cmis:name'] 
     , 'type' => 'file' 
     , 'size' => $document->properties['cmis:contentStreamLength'] 
     , 'createdBy' => $document->properties['cmis:createdBy'] 
     , 'creationDate' => $document->properties['cmis:creationDate'] 
     , 'lastModifiedBy' => $document->properties['cmis:lastModifiedBy'] 
     , 'lastModificationDate' => $document->properties['cmis:lastModificationDate'] 
     , 'parentId' => (isset($document->properties['cmis:parentId']))?$document->properties['cmis:parentId']:'' 
    )); 
} 
$response['total'] = sizeof($response['data']); 
$response['error'] = ''; 

을 나는 $ 경로와 $ 파일 변수를 확인하고 그 값합니다 (이미지가 저장된 폴더와 이미지의 이름)이 올바른지하지만 쿼리 빈 객체 목록을 반환합니다 (따라서 코드는 foreach 루프에 들어 가지 않습니다). 은 $ 쿼리 변수의 값이 같은 것입니다 : 그 쿼리가 작동합니다

SELECT * FROM cmis:document WHERE cmis:name = 'my_image.jpg' AND IN_FOLDER('workspace://SpacesStore/5acb1737-b30a-2ff8-d47a-7f360c235bd0')

답변

1

. Apache Chemistry OpenCMIS Workbench와 같은 것을 사용하여 쿼리 (또는 Alfresco의 노드 브라우저)를 테스트하는 것이 좋습니다.

당신이 인증 한 사용자가 당신이 쿼리하는 폴더에 대한 액세스 권한을 가지고 있지 않을 수 있습니다.

또한 사소한 일이지만, CMIS 객체 ID에 대한 Alfresco 노드 참조를 혼동하지 않도록주의하십시오. 그것들은 같은 것이 아닙니다.