PHP code example of acb-studio / kirby-cloudinary-sync

1. Go to this page and download the library: Download acb-studio/kirby-cloudinary-sync library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

acb-studio / kirby-cloudinary-sync example snippets


// ... your other configuration ...
'acb' => [
    'cloudinary' => [
        'key' => 'MY_CLOUDINARY_KEY',
        'secret' => 'CLOUDINARY_SECRET',
        'cloud' => 'CLOUDINARY_CLOUD_NAME',
        'assetTypes' => ['image'],
    ],
],
// ... your other configuration ...

// ... your other configuration ...
'acb' => [
    'cloudinary' => [
        'key' => fn() => getenv('CLOUDINARY_KEY') ?: env('CLOUDINARY_KEY'),
        'secret' => fn() => getenv('CLOUDINARY_SECRET') ?: env('CLOUDINARY_SECRET'),
        'cloud' => fn() => getenv('CLOUDINARY_CLOUD_NAME') ?: env('CLOUDINARY_CLOUD_NAME'),
        'assetTypes' => ['image', 'video', 'pdf'],
        'removeAssetsLocally' => true,
        'adminArea' => true,
        'eagerTransformations' => fn() => [
            ['format' => 'webp', 'quality' => 'auto:eco'],
            ['format' => 'avif', 'quality' => 'auto:eco'],
        ],
        'imageTransformationDefaults' => [
            'format' => 'webp',
            'quality' => 'auto:eco'
        ],
        'publicId' => fn($file) => implode('.', array_slice(explode('.', $file->id()), 0, -1))
    ],
],
// ... your other configuration ...