Open vesper8 opened 3 years ago
@vesper8 Hi. Have a look https://spatie.be/docs/laravel-medialibrary/v9/advanced-usage/generating-custom-urls
Or you can extend this field if you don't want to use custom image generator.
If you extend this class you also need to use custom fields instead of default ones. https://github.com/dmitrybubyakin/nova-medialibrary-field#fields
@dmitrybubyakin Thank you for the links. It's all a bit confusing though, since S3 with private links is a fairly popular usage case it would be nice if you could add an example to the readme that has everything working
I was already using a custom url generator so I just added this conditional to it and it works
public function getUrl(): string
{
if (substr($_SERVER['REQUEST_URI'], 0, strlen('/nova')) === '/nova') {
$url = $this->getTemporaryUrl(\Carbon\Carbon::now()->addDays(1));
} else {
$url = $this->getDisk()->url($this->getPathRelativeToRoot());
}
$url = $this->versionUrl($url);
return $url;
}
@vesper8 Nice solution!
I am using S3 with private links. I have gotten the previews and downloads to work by using
However when clicking on the eye icon to view the media. The Media Conversions are not signed so they end up being broken images. And also the Media Download URL is also not signed and so is also not working should you decide to copy/paste it
Do you know how I can get these to also work with
->getTemporaryUrl()
?