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
@@ -0,0 +1,55 @@
<?php
namespace App\Services\Media\UrlGenerator;
use DateTimeInterface;
use Spatie\MediaLibrary\UrlGenerator\BaseUrlGenerator;
use Spatie\MediaLibrary\Exceptions\UrlCannotBeDetermined;
class FtpUrlGenerator extends BaseUrlGenerator
{
/**
* Get the url for the profile of a media item.
*
* @return string
*/
public function getUrl() : string
{
return config('media-library.wm-cdn').'/'.$this->getPathRelativeToRoot();
}
/**
* @param \DateTimeInterface $expiration
* @param array $options
*
* @return string
*
* @throws UrlCannotBeDetermined
*/
public function getTemporaryUrl(DateTimeInterface $expiration, array $options = []): string
{
throw UrlCannotBeDetermined::filesystemDoesNotSupportTemporaryUrls();
return 'done';
}
/**
* Get the relative path for the profile of a media item.
*
* @return string
*
*/
public function getPath()
{
return $this->getPathRelativeToRoot();
}
/**
* Get the url to the directory containing responsive images.
*
* @return string
*/
public function getResponsiveImagesDirectoryUrl(): string
{
return config('media-library.wm-cdn').'/'.$this->pathGenerator->getPathForResponsiveImages($this->media);
}
}