You've already forked symfony-storage
Merge branch 'master' of ssh://git.bluesquare.io/bluesquare-packages/symfony-storage
This commit is contained in:
@@ -111,7 +111,8 @@ class S3Storage implements StorageAdaptor
|
||||
'Bucket' => $this->bucket,
|
||||
'Path' => $this->getPrefix().$target_path,
|
||||
'Key' => $this->getPrefix().$target_path,
|
||||
'Body' => file_get_contents($source_path),
|
||||
'SourceFile' => $source_path, // Fix memory allocation
|
||||
//'Body' => file_get_contents($source_path),
|
||||
'ACL' => $permissions
|
||||
]);
|
||||
}
|
||||
@@ -136,19 +137,27 @@ class S3Storage implements StorageAdaptor
|
||||
}
|
||||
|
||||
/**
|
||||
* Ouvre le stream d'un fichier stocké dans S3
|
||||
* @param $distant_path
|
||||
* @param $target_stream
|
||||
*/
|
||||
public function getStream ($distant_path)
|
||||
{
|
||||
return $this->client->getObject([
|
||||
'Bucket' => $this->bucket,
|
||||
'Key' => $this->getPrefix().$distant_path,
|
||||
'Path' => $this->getPrefix().$distant_path,
|
||||
])->get('Body')->detach();
|
||||
}
|
||||
|
||||
/**
|
||||
* Permet de stream un fichier stocké dans S3
|
||||
* @param $distant_path
|
||||
* @param $target_stream
|
||||
*/
|
||||
public function stream ($distant_path, $target_stream)
|
||||
{
|
||||
$aws_stream = $this->client->getObject([
|
||||
'Bucket' => $this->bucket,
|
||||
'Key' => $this->getPrefix().$distant_path,
|
||||
'Path' => $this->getPrefix().$distant_path,
|
||||
])->get('Body')->detach();
|
||||
|
||||
stream_copy_to_stream($aws_stream, $target_stream);
|
||||
stream_copy_to_stream($this->getStream($distant_path), $target_stream);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user