mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-11 01:41:07 +03:30
40 lines
968 B
PHP
40 lines
968 B
PHP
<?php
|
|
|
|
namespace App\Services\Media;
|
|
|
|
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
|
use Spatie\MediaLibrary\Support\PathGenerator\DefaultPathGenerator;
|
|
|
|
class PathGenerator extends DefaultPathGenerator
|
|
{
|
|
|
|
/*
|
|
* Get the path for the given media, relative to the root storage path.
|
|
*/
|
|
/**
|
|
* @param Media $media
|
|
* @return string
|
|
*/
|
|
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/';
|
|
}
|
|
|
|
}
|