Error removing image from Custom Path Generator Media Library
I have this Custom Path Generator:
class CustomPathGenerator implements BasePathGenerator
{
/*
* Get the path for the given media, relative to the root storage path.
*/
public function getPath(Media $media): string
{
return match ($media->model_type) {
Store::class => Store::PATH_IMAGES . '/' . Filament::getTenant()->id . '/' . $media->getKey() . '/',
Catalogue::class => Catalogue::PATH_IMAGES . '/' . Filament::getTenant()->id . '/' . $media->getKey() . '/',
Category::class => Category::PATH_IMAGES . '/' . Filament::getTenant()->id . '/' . $media->getKey() . '/',
Subcategory::class => Subcategory::PATH_IMAGES . '/' . Filament::getTenant()->id . '/' . $media->getKey() . '/',
default => $media->getKey() . '/',
};
}
/*
* Get the path for conversions of the given media, relative to the root storage path.
*/
public function getPathForConversions(Media $media): string
{
return $this->getPath($media).'conversions/';
}
/*
* Get the path for responsive images of the given media, relative to the root storage path.
*/
public function getPathForResponsiveImages(Media $media): string
{
return $this->getPath($media).'responsive-images/';
}
}
It creates correctly the image but If I try to delete de image, not remove the image. Why?0 Replies