Andreas94's avatar

indicate storage disk('do_spaces') in config file

I am using digitalocean spaces to manage the images of my Laravel 7, configuring it as AWS S3.

for the creation of thumbnails I use BKWLD/croppa but I have problems.

for creating a thumbnail in the blade I insert

<img src="{{Croppa::url($value->immagine(), 130, 130, array('quadrant' => 'C'))}}">

in the modal instead I have a check if the image is there or not on the CDN

	public function immagine()
  {
		if (strpos($this->immagine, 'gallery') !== false) {
			if(file_exists(\Storage::disk('do_spaces')->url($this->immagine))) {
				return \Storage::disk('do_spaces')->url($this->immagine);
			} else {
				return \Storage::disk('do_spaces')->url('news/no-img.png');
			}
		} else {
			if(file_exists(\Storage::disk('do_spaces')->url('news/'.$this->immagine))) {
				return \Storage::disk('do_spaces')->url('news/'.$this->immagine);
			} else {
				return \Storage::disk('do_spaces')->url('news/no-img.png');
			}
		}
  }

in the CROPPA configuration file, however, I don't know how to say that it must load the thumbnails into the S3 and not into the VPS.

'src_dir' => public_path().'/upload',
'crops_dir' => public_path().'/upload/crops',
'path' => 'upload/(?:crops/)?(.*)$',
'url_prefix' => '/upload/crops/',

how do you see save in public / upload, how do I indicate here to save to \Storage::disk('do_spaces')?

in case you know packages for creating better thumbnails? Image no because I have to indicate the dimensions of the images directly to the upload and I would like them to be generated at the first visualization.

0 likes
2 replies
Andreas94's avatar

I'm still stuck on how to make thumbnails with croppa in an S3/DigitalOcean Spaces ... ideas?

Please or to participate in this conversation.