Closed mhardaniel closed 6 years ago
@mhardaniel123 @mintbridge @bstrahija @uyab @chadjw Cloudinary is fast becoming the media/file storage platform of choice, offering media manipulation capability and serving over CDN with awesome transformations. It will be nice if there's some sort of integration from media-library to Cloudinary
@mhardaniel123 @mintbridge @bstrahija @uyab @chadjw Cloudinary is fast becoming the media/file storage platform of choice, offering media manipulation capability and serving over CDN with awesome transformations. It will be nice if there's some sort of integration from media-library to Cloudinary
I found this package flysystem-cloudinary. You will need to create a provider:
<?php
namespace App\Providers;
use Enl\Flysystem\Cloudinary\ApiFacade as CloudinaryClient;
use Enl\Flysystem\Cloudinary\CloudinaryAdapter;
use Enl\Flysystem\Cloudinary\Converter\TruncateExtensionConverter;
use Illuminate\Support\Facades\Storage;
use League\Flysystem\Filesystem;
use Illuminate\Support\ServiceProvider;
class CloudinaryServiceProvider extends ServiceProvider
{
/**
* Perform post-registration booting of services.
*
* @return void
*/
public function boot()
{
Storage::extend('cloudinary', function ($app, $config) {
$client = new CloudinaryClient([
'cloud_name' => $config['cloud_name'],
'api_key' => $config['api_key'],
'api_secret' => $config['api_secret'],
'overwrite' => $config['overwrite'],
], new TruncateExtensionConverter());
return new Filesystem(new CloudinaryAdapter($client));
});
}
/**
* Register bindings in the container.
*
* @return void
*/
public function register()
{
//
}
}
in the .env file add:
CLOUDINARY_CLOUD_NAME=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=
and create CloudinaryUrlGenerator
class that will extend Spatie\MediaLibrary\UrlGenerator\BaseUrlGenerator
and implement the methods: getUrl
, getTemporaryUrl
and getResponsiveImagesDirectoryUrl
and do not forget to put the new class in the package configuration file (config/medialibrary.php).
sorry guys. if i using laravel 9, will it work?
@xfkrahmad you should ask that to https://github.com/enl/flysystem-cloudinary
sorry but beginner here..
Cloudinary Support?
tnx. for answering.