Skip to content

Commit e41c4dc

Browse files
committed
Function to create a file
1 parent efbf6c4 commit e41c4dc

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

api/src/S3Client.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class S3Client {
88

99
private $s3Client;
1010

11-
function __construct($S3_KEY, $S3_SECRET, $S3_SERVER)
11+
function __construct($S3_KEY, $S3_SECRET, $S3_SERVER, $S3_BUCKET)
1212
{
1313
$client = new S3Client([
1414
'region' => '',
@@ -22,7 +22,12 @@ function __construct($S3_KEY, $S3_SECRET, $S3_SERVER)
2222
]);
2323
}
2424

25-
public function saveImage() {
26-
//TODO Save image to s3
25+
public function saveImage($im, $id) {
26+
//TODO: Error Handling
27+
$client->putObject([
28+
'Bucket' => $S3_BUCKET,
29+
'Key' => "{$id}.png",
30+
'Body' => $im->getImageBlob()
31+
]);
2732
}
2833
}

0 commit comments

Comments
 (0)