kly / klimg-gcs
GCS upload manager lib for kly
Requires
- php: >=5.3
Requires (Dev)
- vlucas/phpdotenv: v2.6.1
This package is auto-updated.
Last update: 2024-11-08 16:27:57 UTC
README
library for ease of uploading to gcs from legacy script use similar struct and working procedure as existing send_to_server()
HOW TO USE
-
install the package
composer require kly/klimg-gcs
or download the package then include the manual loaderinclude path/to/package/src/loader.php
-
intantiate the manager
$manager = new UploadManager(getenv('GCS_ENDPOINT'), getenv('GCS_KEY'), getenv('GCS_PUBLIC_PREFIX'));
I am using getenv in the example, you could use simple string GCS_ENDPOINT : Google Cloud Storage Endpoint GCS_KEY : Google Cloud Storage Key GCS_PUBLIC_PREFIX : Google Cloud Storage bucket public url prefix -
add the image intended to be sent and designated path for the bucket side
$manager->add(array(/*of files*/ 'images/one.jpg'), 'path/on/the/cloud');
-
when you finish add all the pics execute the transfer
$manager->send()
-
Inspect the result, check any failure
It all just a simple curl wrapper anyway.