Files

54 lines
1.3 KiB
PHP

<?php
namespace App\Services\Media\UrlGenerator;
use DateTimeInterface;
use Spatie\MediaLibrary\MediaCollections\Exceptions\InvalidUrlGenerator;
use Spatie\MediaLibrary\Support\UrlGenerator\BaseUrlGenerator;
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 InvalidUrlGenerator
*/
public function getTemporaryUrl(DateTimeInterface $expiration, array $options = []): string
{
throw new InvalidUrlGenerator();
}
/**
* Get the relative path for the profile of a media item.
*
* @return string
*
*/
public function getPath(): string
{
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);
}
}