Spatie Media Library deleting S3 files
Whenever I upload to one it seems like it deletes the others from the s3, maybe just resetting the bucket folder, I'm not quite sure
Tabs\Tab::make("Media")
->icon("heroicon-o-photo")
->iconPosition(IconPosition::Before)
->schema([
SpatieMediaLibraryFileUpload::make('image')
->disk('s3')
->collection('artwork_primary')
->image()
->imageEditor()
->imageEditorAspectRatios([null, '16:9', '4:3', '1:1'])
->required(),
SpatieMediaLibraryFileUpload::make('images')
->disk('s3')
->multiple()
->reorderable()
->collection('artwork_gallery')
->image()
->imageEditor()
->imageEditorAspectRatios([null, '16:9', '4:3', '1:1']),
SpatieMediaLibraryFileUpload::make('documents')
->disk('s3')
->multiple()
->reorderable()
->collection('artwork_documents')
->preserveFilenames(),
SpatieMediaLibraryFileUpload::make('share_documents')
->disk('s3')
->multiple()
->reorderable()
->collection('artwork_share_documents')
->preserveFilenames(),
]),
Tabs\Tab::make("Media")
->icon("heroicon-o-photo")
->iconPosition(IconPosition::Before)
->schema([
SpatieMediaLibraryFileUpload::make('image')
->disk('s3')
->collection('artwork_primary')
->image()
->imageEditor()
->imageEditorAspectRatios([null, '16:9', '4:3', '1:1'])
->required(),
SpatieMediaLibraryFileUpload::make('images')
->disk('s3')
->multiple()
->reorderable()
->collection('artwork_gallery')
->image()
->imageEditor()
->imageEditorAspectRatios([null, '16:9', '4:3', '1:1']),
SpatieMediaLibraryFileUpload::make('documents')
->disk('s3')
->multiple()
->reorderable()
->collection('artwork_documents')
->preserveFilenames(),
SpatieMediaLibraryFileUpload::make('share_documents')
->disk('s3')
->multiple()
->reorderable()
->collection('artwork_share_documents')
->preserveFilenames(),
]),
1 Reply
I was not registering my collections
So I did this, it seems to have fixed the problem but i am not sure about it, hopefully someone can confirm or deny it, if no answer comes within a day or so i'll mark as solved 🤷♂️
public function registerMediaCollections(): void
{
$this
->addMediaCollection('artwork_primary')
->singleFile()
->useDisk('s3');
$this
->addMediaCollection('artwork_gallery')
->useDisk('s3');
$this
->addMediaCollection('artwork_documents')
->useDisk('s3');
$this
->addMediaCollection('artwork_share_documents')
->useDisk('s3');
}
public function registerMediaCollections(): void
{
$this
->addMediaCollection('artwork_primary')
->singleFile()
->useDisk('s3');
$this
->addMediaCollection('artwork_gallery')
->useDisk('s3');
$this
->addMediaCollection('artwork_documents')
->useDisk('s3');
$this
->addMediaCollection('artwork_share_documents')
->useDisk('s3');
}