Skip to content

Commit aac9f59

Browse files
committed
feat: Add method to copy from Media source to Media destination
1 parent dcdfb3b commit aac9f59

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Handler/MediaHandler.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,22 @@ public function save(UploadedFile $file)
462462
return $this;
463463
}
464464

465+
/**
466+
* @param Media $source
467+
* @param Media $dest
468+
*
469+
* @return bool|int|string
470+
*/
471+
public function copy(Media $source, Media $dest)
472+
{
473+
/* @var AwsS3Adapter|LocalAdapter $adapter */
474+
$adapter = $this->filesystem->getAdapter();
475+
476+
$content = $adapter->read($source->getFullKey());
477+
478+
return $adapter->write($dest->getFullKey(), $content);
479+
}
480+
465481
/**
466482
* @param Media $media
467483
*/

0 commit comments

Comments
 (0)