fix media

This commit is contained in:
mahdi purHosseini
2023-12-09 14:59:00 +03:30
parent 6fa7d2fd0e
commit 530c60b2b5
5 changed files with 170 additions and 24 deletions
+35
View File
@@ -0,0 +1,35 @@
<?php
namespace App\Services\Media;
use Spatie\MediaLibrary\Models\Media;
use Spatie\MediaLibrary\PathGenerator\PathGenerator as BasePathGenerator;
class PathGenerator implements BasePathGenerator
{
/*
* Get the path for the given media, relative to the root storage path.
*/
public function getPath(Media $media): string
{
return md5($media->id).'/';
}
/*
* 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/';
}
}