Help FileUpload
Hello Filament team,
I'm using ImageColumn to display a preview of an uploaded image (via FileUpload) that's stored on the public disk, inside a subdirectory (hero/). I’m running into a strange issue.
Goal :
Display a preview of the image in the admin panel list view (Filament table).
Context :
The image_path field in the database only stores the filename (e.g. image123.webp).
Files are correctly saved in storage/app/public/hero.
The storage symlink (public/storage) is created and working (php artisan storage:link).
But Have a Problem
If I try:
ImageColumn::make('image_path')
->label('Preview')
->disk('public')
->path('hero') //error here
I get this error:
BadMethodCallException: Method Filament\Tables\Columns\ImageColumn::path does not exist.
Workaround :
I can work around it with:
ImageColumn::make('image_path')
->label('Preview')
->disk('public')
->getStateUsing(fn ($record) => 'hero/' . $record->image_path)
But this isn’t very intuitive, especially since FileUpload accepts a ->directory() method.
My question:
Is ImageColumn supposed to support something like ->path() (just like FileUpload::directory())?
Or is it expected that we manually adjust the path using getStateUsing()?
3 Replies