How to control order of images in spatie media library field while saving?
I have a SpatieMediaLibraryFileUpload field for images in my Filament resource. It's multiple. When I choose or drag&drop files there they have some order in preview. But after I save them their order is changed. But it's a bit confusing thing - before you save them, you can't be sure what order you'll get. What we could do to be sure that order in the preview will be saved? Thanks!
My field looks like that now:
'images' => SpatieMediaLibraryFileUpload::make('images')
->label(__('general.images.label'))
->collection('images')
->columnSpan(2)
->imagePreviewHeight('250')
->panelLayout('grid')
->image()
->multiple()
->enableOpen()
->enableReordering()
->uploadProgressIndicatorPosition('left')
->disk(app()->environment('local') ? 'public' : config('media-library.disk_name'))
->visibility(function () {
return (config('media-library.disk_name') === 's3') && config('someproject.store_images_private', true) ? 'private' : 'public';
})
->reactive(),
0 Replies