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?20 Replies
What console error are you seeing for the missing image?
Looks like your image is not public or storage is not linked
there is nothing in the console
There has to be. š otherwise the image would be loading.
Images that are not successfully displayed are in the same folder as images that are successfully displayed
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.
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
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
the console error went away, but still didn't fix the problem
Make sure youāre not caching any views or components and that the browser hasnāt cached the response.
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
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.
yes this 'images' data is in a relation... so I display the relation data via RepeatableEntry like this:
btw 'surveyed' is the name of the relationship
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.
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.
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.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?
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.
okay, thanks a lot @awcodes for helping answer, maybe later I'll try to create a minimum reproducible repo.