webplusmultimedia / filament-json-media

a media library base on json field with custom properties + Galleries on front-end
https://filamentphp.com/plugins/webplusm-json-media
MIT License
8 stars 2 forks source link

[Bug]: Issue when using S3 Bucket #10

Open Erth0 opened 3 months ago

Erth0 commented 3 months ago

What happened?

When using S3 Bucket for storage the file is not being moved from livewire-tmp to the intended path. The file details are saved into the json column however the actual file does not exist.

How to reproduce the bug

Filament Resource:

JsonMediaGallery::make('images')
  ->directory('services')
  ->reorderable()
  ->preserveFilenames()
  ->multiple()
  ->disk('s3')
  ->visibility('public')
  ->image()
  ->downloadable()
  ->deletable()
  ->withCustomProperties(
      customPropertiesSchema: [
          Forms\Components\TextInput::make('title')
              ->maxLength(255),
          Forms\Components\Textarea::make('description'),
      ],
      editCustomPropertiesOnSlideOver: true,
      editCustomPropertiesTitle: "Edit details"
  )
]);

Package Version

2.1

PHP Version

8.2.

Laravel Version

11.0

Which operating systems does with happen with?

macOS

Notes

No response

Erth0 commented 3 months ago

I am sorry this is not a bug at all but also is not related to the package. To fix this issue if someone will run into it you have to call ->moveFiles() method into the component basically this:

JsonMediaGallery::make('images')
  ->directory('services')
  ->reorderable()
  ->preserveFilenames()
  ->multiple()
  ->disk('s3')
  ->visibility('public')
  ->image()
  ->downloadable()
  ->deletable()
  ->withCustomProperties(
      customPropertiesSchema: [
          Forms\Components\TextInput::make('title')
              ->maxLength(255),
          Forms\Components\Textarea::make('description'),
      ],
      editCustomPropertiesOnSlideOver: true,
      editCustomPropertiesTitle: "Edit details"
  )
->moveFiles()
]);
webplusmultimedia commented 3 months ago

Yep, also, this package wasn't build/ test for S3. Maybe thumbs doesn't work on S3 from this package too If that's work, tell me.

Erth0 commented 3 months ago

That's correct thumbs do not work for S3

webplusmultimedia commented 3 months ago

Thanks for the report. I will probably do an update when I have tested