get skills directly from s3 server
This commit is contained in:
parent
bfae5cc098
commit
d465f5ecb8
2 changed files with 13 additions and 2 deletions
|
@ -18,7 +18,7 @@ class Skill extends HTMLElement {
|
||||||
skills.forEach(skill => {
|
skills.forEach(skill => {
|
||||||
const image = document.createElement("img");
|
const image = document.createElement("img");
|
||||||
image.classList.add("skills");
|
image.classList.add("skills");
|
||||||
image.src = "/API/getFile.php?filename=" + skill;
|
image.src = skill;
|
||||||
this.appendChild(image);
|
this.appendChild(image);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,18 @@ function getSkills() {
|
||||||
|
|
||||||
$response = [];
|
$response = [];
|
||||||
foreach ($result["Contents"] as $skill){
|
foreach ($result["Contents"] as $skill){
|
||||||
array_push($response, $skill["Key"]);
|
// Get a command object from the client
|
||||||
|
$command = $s3Client->getCommand('GetObject', [
|
||||||
|
'Bucket' => $S3BucketName,
|
||||||
|
'Key' => $skill["Key"]
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Create a pre-signed URL for a request with duration of 10 miniutes
|
||||||
|
$presignedRequest = $s3Client->createPresignedRequest($command, '60 minutes');
|
||||||
|
|
||||||
|
// Get the actual presigned-url
|
||||||
|
$downloadURL = (string) $presignedRequest->getUri();
|
||||||
|
array_push($response, $downloadURL);
|
||||||
}
|
}
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue