Bobby,
thanks for your reaction.
The reason why i use glide is because the package helps me the crop the images to the right dimensions.
So i can keep the original in place and create a cached image with the right dimensions.
So my plan is to:
- save the original on do spaces
- save the cached images on my webserver
About the last step i'm thinking of putting these on do spaces as well. Don't know what is best.
What do you think about this way of working? Do you suggest a different approach?
About the problem: i got it working with help of this post: https://github.com/thephpleague/glide/issues/100
For people interested:
- i used the default filestem adjustments
'do-spaces' => [
'driver' => 's3',
'key' => 'xxx',
'secret' => 'xxx',
'region' => 'ams3',
'bucket' => 'xx',
'endpoint' => 'https://ams3.digitaloceanspaces.com',
],
in combination with this in my controllers.
public function show_listing_230(Filesystem $filesystem, $path)
{
$server = ServerFactory::create([
'response' => new LaravelResponseFactory(app('request')),
'source' => Storage::disk('do-spaces')->getDriver(),
'source_path_prefix' => '/xxx/images/listings/230',
'cache' => Storage::disk('local')->getDriver(),
'cache_path_prefix' => '/xxx/images/listings/230/cache_images',
'base_url' => 'img_listing/230/',
]);
return $server->getImageResponse($path, request()->all());
}