F
Filamentā€¢6mo ago
EL REKT

ImageEntry does not display images

My data is in array form like this : [ "uploads\/ticket-images\/progress\/BQv2jKNamipq3wsEDGR6pgfA6oyrq55BGwxHndxP.jpg", "uploads\/ticket-images\/progress\/KWP0uw6VyVrC5ikG9fD8dWwkpQZUEI3cw9XfN6to.jpg" ] and this is my way to display it to ImageEntry : Infolists\Components\ImageEntry::make('images')->grow(true)->circular()->stacked(), In some resources this method works, but this time it doesn't work... what's wrong?
No description
No description
20 Replies
awcodes
awcodesā€¢6mo ago
What console error are you seeing for the missing image?
Dennis Koch
Dennis Kochā€¢6mo ago
Looks like your image is not public or storage is not linked
EL REKT
EL REKTOPā€¢6mo ago
there is nothing in the console
awcodes
awcodesā€¢6mo ago
There has to be. šŸ™‚ otherwise the image would be loading.
EL REKT
EL REKTOPā€¢6mo ago
Images that are not successfully displayed are in the same folder as images that are successfully displayed
awcodes
awcodesā€¢6mo ago
The browser is saying that it canā€™t load the image some something either off with the url or there could be a permissions issue for the file, or could even be a CORS issue. We have no way of troubleshooting that without the devtools console output.
EL REKT
EL REKTOPā€¢6mo ago
there is only this on the console, I think it is not related to this case..and the images can be accessed via the link directly in a web browser
No description
awcodes
awcodesā€¢6mo ago
Ok. So for some reason those images are trying to load over http instead of https. Make sure the app url in your env has https
EL REKT
EL REKTOPā€¢6mo ago
the console error went away, but still didn't fix the problem
awcodes
awcodesā€¢6mo ago
Make sure youā€™re not caching any views or components and that the browser hasnā€™t cached the response.
EL REKT
EL REKTOPā€¢6mo ago
I tried this just now: 1. clear browser data (cache, etc.) 2. display the data in TextEntry (because I was afraid the data would be empty, but it turns out it's not.) 3. Check via inspect element, it turns out src (source) is empty
awcodes
awcodesā€¢6mo ago
Is ā€˜imagesā€™ a relationship in this case where it isnā€™t working. At this point, I would have to see more of the code to be able to help. But given that itā€™s working in some cases and not others, I doubt that itā€™s directly a filament issue.
EL REKT
EL REKTOPā€¢6mo ago
yes this 'images' data is in a relation... so I display the relation data via RepeatableEntry like this:
No description
EL REKT
EL REKTOPā€¢6mo ago
btw 'surveyed' is the name of the relationship
awcodes
awcodesā€¢6mo ago
If itā€™s a relationship shouldnā€™t it be something like make(ā€˜images.pathā€™)? Iā€™m starting the think the relationship is off possibly. If itā€™s a relationship then images has to have a db column name for the path.
EL REKT
EL REKTOPā€¢6mo ago
no, if you write 'images.path' then 'images' is the name of the relationship, right? in this case 'images' is a column, the name of the relationship is declared in "RepeatableEntry::make('surveyed')'. This method is successful in some cases, as evidenced by the 'images' data that can be displayed via TextEntry.
awcodes
awcodesā€¢6mo ago
Right but if images is a relationship i would expect it to not be a flat array of paths. So surveyed->images would be the collection/array of models for the images. Not a flat array.
EL REKT
EL REKTOPā€¢6mo ago
hmmm, but what I'm confused about is why this method works in some other cases? ha ha Or are there any suggestions for displaying links in text form that can be opened in a new tab?
awcodes
awcodesā€¢6mo ago
Honestly, Iā€™m at a loss right now. Itā€™s just not adding up to me based on what has been shared. If you have a repo you can share or a minimum reproducible repo Iā€™d be happy to have a look further. But Iā€™m out of ideas at the moment.
EL REKT
EL REKTOPā€¢6mo ago
okay, thanks a lot @awcodes for helping answer, maybe later I'll try to create a minimum reproducible repo.
Want results from more Discord servers?
Add your server