ImageColumn not setting src attributes

TextColumn::make("id")
->label("ID"),
TextColumn::make("name")
->label("Nome"),
TextColumn::make("real_price")
->money('EUR')
->label("Prezzo"),
ImageColumn::make('image_path')
->getStateUsing(fn (Product $product) => $product->image_path)
->defaultImageUrl('/assets/images/default.png')
->label('Immagine')
TextColumn::make("id")
->label("ID"),
TextColumn::make("name")
->label("Nome"),
TextColumn::make("real_price")
->money('EUR')
->label("Prezzo"),
ImageColumn::make('image_path')
->getStateUsing(fn (Product $product) => $product->image_path)
->defaultImageUrl('/assets/images/default.png')
->label('Immagine')
I have this code and I'm trying to display an image using imageColumn. The issue is that no src is being set in the image in the HTML and I really don't know how to debug it. When dumping the values in getStateUsing the value of the path is correct, however, it is not being set on the html as you can see:
<img src="" style="height: 2.5rem;" class="max-w-none object-cover object-center ring-white dark:ring-gray-900">
<img src="" style="height: 2.5rem;" class="max-w-none object-cover object-center ring-white dark:ring-gray-900">
I have no idea on how to debug it, I'm using Filament v3.2.92
2 Replies
toeknee
toeknee2mo ago
I would dd the image_path? getStateUsing shouldn't be needed since it should be a product already right?
Grégoire
Grégoire2mo ago
I had this problem once and it was actually due to the disc not being set to public when uploading. Might be worth checking where that image is, which disc is used in the env file, etc.
Want results from more Discord servers?
Add your server