Private Image not showing
Form:
FileUpload::make('image')
->image()
->disk('local')
->directory('post-images')
->visibility('private')
->placeholder('Upload an image')
->columnSpanFull()
->required(),
Column:
ImageColumn::make('image')
->disk('local')
->visibility('private'),
Error: Still not viewable. Do I need to set up the other configuration files?
Solution:Jump to solution
Thanks, @Dennis Koch @awcodes .
I realized that using the column
foto
in both the database as a column name and in the filesystems.php
config file was causing the problem.
I discovered when I noticed that setting up the label for "fotos" was ignored in the resource table:
```php...11 Replies
So the disk is non public, right? Yes you need to set up a controller that serves those files and configure the
temporaryUrl()
for your disk.I also have the same problem in latest Filament v3 and Laravel v11. The
ImageColumn()
method is displaying the photo name, instead of the image itself.
Here's my disk config at filesystems.php
:
Here's the ImageColumn()
method in the Resource:
That displays the picture file name, instead of the photo image itself.
However, I can see the image right at the form:
What am I missing to make it display the image itself in the table, instead of the filename???
Any ideas?You need what Dennis recommended. Private files need to go through a proxy url that can sign them to make them accessible in a browser.
The controller is where you would validate that the user has the right permissions to view the file.
hello! I have tried 'public' in the
filesystems.php
config and have got the same result. =( Then, how to set that controller up?Your code isn’t actually setting anything to private. Did you run ‘php artisan storage:link’?
Never mind I see it in your config. Yea with public you need to make sure to symlink the storage directory, with private you have to go through a controller. There should be plenty of tutorials on that on the web. It’s a laravel thing and not a filament thing.
It could also be something as simple as the wrong url in the env or an asset_url in the env.
What is strange is that I can see the image right in the form:
However, in the table, I only see the name of the file, instead of the image itself:
What I have tried is setting up a custom PhotoColumn.php:
that I use in the Resource table:
here's the view:
and I still see the exact same result: the image name, instead of the image itself.
By the way, setting up a label doesn't work.
the label text "Fotografía" is not displayed, but "Foto" instead
Any ideas how to fix this? How to make the images display?
What does the outputted HTML look like? Makes no sense that your custom column doesn't work
The HMTL of the table looks like the following:
Any ideas?
Are you sure you are looking at the right code/the right table? That just doesn’t make sense.
Solution
Thanks, @Dennis Koch @awcodes .
I realized that using the column
foto
in both the database as a column name and in the filesystems.php
config file was causing the problem.
I discovered when I noticed that setting up the label for "fotos" was ignored in the resource table:
then I started changing the name to whatever and test the label()
to see whether or not was ignored.
So, finally it worked when I changed the word "foto" to something else:
and in filesystems.php
So, "private" visibility was not causing any problem.
now it finally is working 🎉Glad you figured it out.