Skip to content

Commit efbf6c4

Browse files
committed
Moving around client and making a class
1 parent bbc81e7 commit efbf6c4

File tree

3 files changed

+29
-25
lines changed

3 files changed

+29
-25
lines changed

api/schedule.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ function renderSvg($svg, $id) {
221221

222222

223223
// Write it to the filesystem
224+
// TODO: Write to S3 instead
224225
$im->writeimage("../img/schedules/{$id}.png");
225226
$im->clear();
226227
$im->destroy();

api/src/S3Client.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace Connections;
4+
5+
use Aws\S3\S3Client;
6+
7+
class S3Client {
8+
9+
private $s3Client;
10+
11+
function __construct($S3_KEY, $S3_SECRET, $S3_SERVER)
12+
{
13+
$client = new S3Client([
14+
'region' => '',
15+
'version' => '2006-03-01',
16+
'endpoint' => $S3_SERVER,
17+
'credentials' => [
18+
'key' => $S3_KEY,
19+
'secret' => $S3_SECRET
20+
],
21+
'use_path_style_endpoint' => true
22+
]);
23+
}
24+
25+
public function saveImage() {
26+
//TODO Save image to s3
27+
}
28+
}

inc/s3Client.php

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)