Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File upload and presentation with json storage #136

Open
PeterB513 opened this issue Sep 13, 2021 · 1 comment
Open

File upload and presentation with json storage #136

PeterB513 opened this issue Sep 13, 2021 · 1 comment
Labels
question Further information is requested

Comments

@PeterB513
Copy link

I read in the description that it is only possible to present an uploaded file in flex as it is stored as folder storage.
I made a flex object solution with json storage. It includes an uploaded a file in de json file. The file represents a bookcover of a stored book.
What I noticed is that the uploaded file data is stored in the json file. The actual file is stored in de same folder as the json file. I also noticed that the uploaded file in this solution is presented in the admin of this flex object.

With this solution, I tried to present the collection via twig. All the text fields are presented but not the image.
My question is, even if description says that it not possible, is there a way to present the image via twig? Because in admin the image is presented correcly and all the ingredients are in the json file. If there is a way, what is the twig code solution? Or should I use folder storage anyway.

@mahagr
Copy link
Contributor

mahagr commented Sep 13, 2021

Use object.media[...] or even object.getMediaField('fieldname')[...], both should work. With the second approach, you can even loop through the images.

That said, I'm currently working on making it even easier to work with the relationships, but that code hasn't been committed yet.

@mahagr mahagr added the question Further information is requested label Sep 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants