F
Filament5mo ago
adnn

Rich editor that saves images on a cloud disk? (Bunny, S3, R2 etc)

Does anyone know if it's possible to change the default rich editor, or if there's a plugin that allows inserting images but saving the image on an external disk, such as cloudflare r2, bunny etc? Currently the rich editor is saving the images locally in laravel storage despite the disk being bunny globally
7 Replies
Dhru
Dhru5mo ago
you can pass in a file attachment disk to use any disk you have configured in laravel
use Filament\Forms\Components\RichEditor;

RichEditor::make('content')
->fileAttachmentsDisk('s3')
->fileAttachmentsDirectory('attachments')
->fileAttachmentsVisibility('private')
use Filament\Forms\Components\RichEditor;

RichEditor::make('content')
->fileAttachmentsDisk('s3')
->fileAttachmentsDirectory('attachments')
->fileAttachmentsVisibility('private')
adnn
adnnOP5mo ago
@Dhru Thanks for your reply, sadly I just get Unable to retrieve the visibility for file at location: attachments/wxGjPjOTTUpr3MIRNGGYiRWwuXYo6rgjqJBWmICE.jpg. But it gets uploaded correctly to Cloudflare R2
Dhru
Dhru5mo ago
You need to configure R2 to make the file public
BigBy
BigBy3mo ago
Hello. Did you manage to solve the problem?
awcodes
awcodes3mo ago
I think the problem you might be running into is that private files have a token associated with the url, which becomes a problem when that url is stored in a rich editor, meaning that the token has expired when the content is read back out. The v4 rich editor will handle this, but in v3 you’ll have to preread the content and assign new expires tokens to the images.
BigBy
BigBy3mo ago
Okay, thanks for the answer
adnn
adnnOP3mo ago
No, I gave up on it

Did you find this page helpful?