Infolist ImageEntry question

Hi Guys, I am able to save the file to the local disc in my create form:
FileUpload::make('attachments')
->columnSpanFull()
->label('POD Image')
//->disk('public')
FileUpload::make('attachments')
->columnSpanFull()
->label('POD Image')
//->disk('public')
And I can see the uploaded file in this folder: /storage/app/public/ and this is working well. However, I have a question regarding the infolist ImageEntry which I want to use to display said image. According to the docs: The entry must contain the path to the image, relative to the root directory of its storage disk, or an absolute URL to it. So in order to test this, I have ensured that there are 2 images in the public disc: sushi.jpg and test.jpg I have tried the following ways to display an image:
ImageEntry::make('https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRy1FCk4ILwKxcNzcvjHpj0lqPVfuUCGKeg2w&s')
->label('POD Images6')
->height(500)
->width(500),

ImageEntry::make('test')
->label('POD Image 7')
->height(500)
->width(500),

ImageEntry::make('test.jpg')
->label('POD Image 8')
->height(500)
->width(500),

ImageEntry::make('sushi')
->label('POD Image 9')
->disk('public')
->height(500)
->width(500),

ImageEntry::make('sushi.jpg')
->label('POD Image 10')
->disk('public')
->height(500)
->width(500),
ImageEntry::make('https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRy1FCk4ILwKxcNzcvjHpj0lqPVfuUCGKeg2w&s')
->label('POD Images6')
->height(500)
->width(500),

ImageEntry::make('test')
->label('POD Image 7')
->height(500)
->width(500),

ImageEntry::make('test.jpg')
->label('POD Image 8')
->height(500)
->width(500),

ImageEntry::make('sushi')
->label('POD Image 9')
->disk('public')
->height(500)
->width(500),

ImageEntry::make('sushi.jpg')
->label('POD Image 10')
->disk('public')
->height(500)
->width(500),
I can understand if the formatting is wrong for the rest of these configs, but surely the absolute path ImageEntry should work? I cannot see any relevant information in the laravel log either, anyone have any idea what I am doing wrong here? Thanks in advance
Solution:
in the make you provide a db column
Jump to solution
3 Replies
Solution
krekas
krekas6mo ago
in the make you provide a db column
Dennis Koch
Dennis Koch6mo ago
::make()takes the name of the columns as an argument. Not the actual image path. So in your case that would be ::make('attachments')
zander9255
zander9255OP6mo ago
Thank you so much guys, I really appreciate the answers! I came right with the changes you suggested. Hope you both have a fantastic weekend!
Want results from more Discord servers?
Add your server