Score:0

Display images from private files to public

bd flag

Is it possible to display private files/images to the public for example with tiwg tweak?

I've tried examples from here: https://www.specbee.com/blogs/twig-tweak-in-drupal-9-functions-and-filters which was the best I could find relating to my issue.

In the article from above I found:

{{ drupal_field(field_name, entity_type, id, view_mode, language,access_check) }}

And this is the code I used, which didn't throw an error but gave me results neither:

{{ drupal_field('field_event_image', 'node', { type: 'image_url', settings: { image_style: 'medium'} }, check_access=false) }}

The relevant thing should be the access check, but maybe it's just me and I don't know how to use it right.

cn flag
Do you have special permissions hiding the private files? Usually, private files are served through the *private* file system, but they are not hidden from the public.
au flag
Note that `check_access=false` is related to the parent node no to the referenced file.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.