I would like my Kirby to store the files it creates in the ‘media’ directory on Digital Ocean Spaces (equivalent and works the same as AWS S3)
I understand how to modify the Kirby ‘root’ directories to look for the directories in a different directory, so I think I can handle that part. The part I don’t understand is how to modify where and how Kirby writes the cache files to.
To upload files to DO Spaces or S3 I need to use some parameters including a ‘key’ and ‘secret’. I can leverage the
aws/aws-sdk-php library to do this from PHP, which will employ a method in the following form to do so:
require 'vendor/autoload.php'; use Aws\S3\S3Client; $client = new Aws\S3\S3Client([ 'version' => 'latest', 'region' => 'us-east-1', 'endpoint' => 'https://nyc3.digitaloceanspaces.com', 'credentials' => [ 'key' => 'SPACES_KEY', 'secret' => 'SPACES_SECRET', ], ]);
So, I suppose the questions are:
[a] Is it possible Media::publish() method
[b] If yes, how do I override Media::publish() with the custom function above when Kirby creates media files for the cache?
Looking forward to any comments you may have, and thanks in advance