diff --git a/js/customElements/skills.js b/js/customElements/skills.js index 383952a8fb89802cc7a058f21d66f78cda82a7c2..60e306861299e567b915fd9ec9313dce3371f94d 100644 --- a/js/customElements/skills.js +++ b/js/customElements/skills.js @@ -18,7 +18,7 @@ class Skill extends HTMLElement { skills.forEach(skill => { const image = document.createElement("img"); image.classList.add("skills"); - image.src = "/API/getFile.php?filename=" + skill; + image.src = skill; this.appendChild(image); }); diff --git a/public/API/queries/skills.php b/public/API/queries/skills.php index 5bd97dad607c3b1ce3846d12983ef1388ff50e67..93b00deb9110dfe9be1c593ba89ef6421abc9499 100644 --- a/public/API/queries/skills.php +++ b/public/API/queries/skills.php @@ -17,7 +17,18 @@ function getSkills() { $response = []; 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; }