示例#1
0
 public function publish(FileInterface $file)
 {
     $fileType = $file->getExtension();
     $fileUploadLink = $file->getPath();
     $fileName = $file->getNameKey() . "." . $fileType;
     if ($file instanceof Image) {
         if ($file->isProcessed()) {
             $size = $file->getImageSize();
             $folder = $size->getWidth() . 'x' . $size->getHeight();
         } else {
             $folder = "original";
         }
     } else {
         $folder = "files";
     }
     $this->s3Client->putObject(array('Bucket' => $this->bucket, 'Key' => $this->url . $this->subfolder . $folder . '/' . $fileName, 'Body' => file_get_contents($fileUploadLink), 'ACL' => 'public-read', 'ContentType' => $file->getType()));
 }