F
Filament6mo ago
bogi99

ImageColumn

and FileUpload , so i upload the file ( image ) FileUpload::make('filepath')->disk('local')->directory('images')->visibility('public')->preserveFilenames()->image(), it finishes the upload, i see the picture with the green hue, but when i go to edit the record, i just get the gray rectangle , no picture view, i tried the .env tricks , nothing. same situation with the table display, ImageColumn::make('filepath')->width(60)->height(60), no image is being shown. the files are uploaded for sure, me seeing them again, not happening .. please help
29 Replies
awcodes
awcodes6mo ago
Did you run php artisan storage:link and what errors are you seeing in the console.?
bogi99
bogi996mo ago
yes, i did , many times with --force one of the problems is solved , i needed to add FileUpload::make('filepath')->disk('local')->directory('public/images')->visibility('public')->preserveFilenames()->image(), 'public/images' to the directory and now the edit shows the picture ... put the list view is still broken
awcodes
awcodes6mo ago
That shouldn’t be needed. The public disk is the public directory. Maybe your disk config is off.
bogi99
bogi996mo ago
how can that be off, i followed the instructions
DrByte
DrByte6mo ago
I think he meant something wrong with your Laravel config. Filament's just doing what you tell it to do.
the list view is still broken
So, if you go to the image cell in your table, and inspect it, what's the HTML that's trying to render the image? Does it have a valid image path for the img src ? You could also look at the browser's network inspection tab or the sources inspection tab, and see what image file assets are throwing errors when trying to load, and then look at exactly what it's trying to load. You'll probably find that there's a wrong path being specified. And then you can fix that.
bogi99
bogi996mo ago
there is no trace of an image tag, only a div with height and width
awcodes
awcodes6mo ago
Is filepath fillable on your model.?
bogi99
bogi996mo ago
yep
awcodes
awcodes6mo ago
And what is actually saved to that field in the db?
bogi99
bogi996mo ago
public/images/DSC_0103.JPG
awcodes
awcodes6mo ago
If the disk is setup correctly then you wouldn’t have ‘public’ as part of that path. storage:link sets that up automatically.
bogi99
bogi996mo ago
php artisan storage:link --force and it still didn't work until i added the public part
awcodes
awcodes6mo ago
There’s a config setting off somewhere. What is in config/filesystems.php ‘disks’ Something in your app is overriding the normal / default disks.
bogi99
bogi996mo ago
ImageColumn::make('filepath')->disk('local')->visibility('public'), added visibility public and now the list shows up is this normal, for the filament to absolutely misconfigure itself by default?
awcodes
awcodes6mo ago
Filament doesn’t misconfigure this. It uses Laravel’s storage and filesystem, so if something is off, it’s in the app.
bogi99
bogi996mo ago
'public' => [ 'driver' => 'local', 'root' => storage_path('app/public'), 'url' => env('APP_URL').'/storage', 'visibility' => 'public', 'throw' => false, ], this is my config/filesystems.php section unchanged from install
awcodes
awcodes6mo ago
That looks ok. Something is off somewhere though. Could even be in your nginx config.
bogi99
bogi996mo ago
using artisan serve , not even apache / nginx
awcodes
awcodes6mo ago
Well that will create issues. Serve runs on a specific port and ip while the storage facade will return it as localhost creating mismatch. What is the actual app_url set to in your .env
bogi99
bogi996mo ago
awcodes
awcodes6mo ago
And when you inspect the img src what is the url?
bogi99
bogi996mo ago
<img src="/storage/images/DSC_0141.JPG" style=" height: 40px;
" class="">
awcodes
awcodes6mo ago
And I highly recommend not using serve when dealing with assets. Valet, homestead or heard would keep this from happening. Yea, something is happening with your storage link. Seems like it’s not getting symlinked properly. If it’s working for you great, but I think you might have problems with this going to production.
bogi99
bogi996mo ago
simlink in public/storage is /home/bogi/src/ik-photog-take-2/storage/app/public
awcodes
awcodes6mo ago
Try this.
FileUpload::make('filepath')->directory('images')->preserveFilenames()->image()
FileUpload::make('filepath')->directory('images')->preserveFilenames()->image()
Will have to upload the image again though. The disk shouldn’t need to set to local and it defaults to public. You might be trying to override things that don’t need to be overridden.
bogi99
bogi996mo ago
ok, that worked, but now the ImageColumn is broken again ImageColumn::make('filepath'), works wow
awcodes
awcodes6mo ago
There you go. Sorry for all the back and forth, just now realized what was happening when you were setting the disk to ‘local’ Hard to read code on a phone with no syntax highlighting. Lol.
bogi99
bogi996mo ago
the back and forth is fine, i wanted to get to the bottom of it. i wanted to set the disk to local , as a i wanted it there, but i guess that messed things up
awcodes
awcodes6mo ago
Images need a url that can be accessed publicly, unless it’s strictly for download. That’s where the visibility option comes in into play. If the visibility is private then it will append a token to the url so the image can only be accessed with the token.
Want results from more Discord servers?
Add your server
More Posts
deferLoading Placeholder TextIs it possible to have a default row much like with emptyStateHeading but for when the table is loadAuthorization on Repeater Form field relationIs possible to add authorization to form fields. I know I can add a hide() and pass a closure that Allow reorderable without fillable column?Good evening everyone! I am somewhat stuck on adding reorderable. I noticed that I am required to aThe GET method is not supported for route livewire/update. Supported methods: POST.I've been getting this error very randomly, some users in the web app get it while others don't and Is there any library to scan QRcode? after generate it i want to scann itIm looking for library or pluging that help to do scann QRcode to check or delete or log in by usingTable Sub-RowsHello, Let's say we have order hasMany items, Is there a way to display orders table with sub-rows Pivot column in many to many relationship - form builderi have the following form: Forms\Components\Section::make('Linked Businesses') Dynamically Retrieve and pass Link from JSONB Column within RepeatableEntryI'm facing an issue while trying to pass a callback function to the url() method within a RepeatableHow to redirect route to panel with id or channel_id?I have this route: Route::get('/login', function () { return redirect(route('filament.admin.authJson column casted as array searchable in filament admin panelHey, Do you know how I can make a text column searchable in filament if it's a json column casted a