PHP code example of carlosocarvalho / flysystem-cloudinary
1. Go to this page and download the library: Download carlosocarvalho/flysystem-cloudinary 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/ */
carlosocarvalho / flysystem-cloudinary example snippets
use CarlosOCarvalho\Flysystem\Cloudinary\CloudinaryAdapter;
use League\Flysystem\Filesystem;
$adapter = new CloudinaryAdapter();
$filesystem = new Filesystem( $adapter );
use CarlosOCarvalho\Flysystem\Cloudinary\CloudinaryAdapter;
use League\Flysystem\Filesystem;
$config = [
'api_key' => ':key',
'api_secret' => ':secret',
'cloud_name' => ':name',
];
$adapter = new CloudinaryAdapter($config);
$filesystem = new Filesystem( $adapter );
#Options use file type resource
$filesystem->listContents()
use Illuminate\Filesystem\FilesystemAdapter;
use Illuminate\Support\Facades\Storage;
use League\Flysystem\Filesystem;
use CarlosOCarvalho\Flysystem\Cloudinary\CloudinaryAdapter;
...
Storage::extend('cloudinary', function ($app, $config) {
if(!empty(env('CLOUDINARY_URL'))){
$adapter = new CloudinaryAdapter();
}else{
$adapter = new CloudinaryAdapter($config);
}
return new FilesystemAdapter(
new Filesystem($adapter, $config),
$adapter,
$config
);
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.