lunarphp / livewire-starter-kit

Demonstration online store for Lunar
https://docs.lunarphp.io/core/starter-kits.html
161 stars 52 forks source link

When we delete image of product from multiple collection all images are getting deleted #57

Closed imrancoder closed 1 year ago

imrancoder commented 1 year ago

image image

glennjacobs commented 1 year ago

Please provide instructions on how to reproduce.

imrancoder commented 1 year ago

Please provide instructions on how to reproduce.

  1. Seed Products
  2. Add Multiple Images for single product and save
  3. Delete any image from single product page and save

After this all images are deleted from folder

alecritson commented 1 year ago

In config/media-library.php can you try changing:

'path_generator' => MediaPathResolver::class,

to

'path_generator' => Spatie\MediaLibrary\Support\PathGenerator\DefaultPathGenerator::class,

and see if that fixes the problem?

imrancoder commented 1 year ago

In config/media-library.php can you try changing:

'path_generator' => MediaPathResolver::class,

to

'path_generator' => Spatie\MediaLibrary\Support\PathGenerator\DefaultPathGenerator::class,

and see if that fixes the problem?

No its not working with Spatie\MediaLibrary\Support\PathGenerator\DefaultPathGenerator::class,

and after installing lunar with 'path_generator' => MediaPathResolver::class, images are loading image

but with 'path_generator' => Spatie\MediaLibrary\Support\PathGenerator\DefaultPathGenerator::class, images are not loading as images are present in storage folder image

alecritson commented 1 year ago

The provided media resolver has been removed in favour of Spatie's own. If you change the path resolver then you would need to regenerate the images.

wychoong commented 1 year ago

note need to migrate/move the image files to Spatie's directory structure if changing from demo's MediaPathResolver to Spatie's DefaultPathGenerator