@nzmattman This sounds like something you should be configuring in your disk configuration; not doing string manipulation in your Nova resources, because you’re going to have to do the same manipulation in every resource you want preview images.
Jul 4, 2024
2
Level 7
Image previews with laravel nova
Hi team.
I have an app that uses a different sub domain for nova and a different sub domain for public.
I am having issues with images loading their previews in nova.
An empty image and the blog saying it is not found
however, when I view the resource, I can see the images.
Here is what I have so far;
filesystem
'guides' => [
'driver' => 'local',
'root' => storage_path('app/public/guides'),
'url' => env('APP_URL').'/storage/guides',
'visibility' => 'public',
],
resource
public function fields()
{
return [
Image::make('Image')
->disk('guides')
->disableDownload()
->prunable()
->thumbnail(function ($value, $disk) {
return $value
? str_replace('www', 'admin', Storage::disk($disk)->url($value))
: null;
})
->preview(function ($value, $disk) {
return $value
? str_replace('www', 'admin', Storage::disk($disk)->url($value))
: null;
})
->required(),
URL::make('Link'),
];
}
for the life of me I can't workout what is happening
any ideas?
Please or to participate in this conversation.