Score:0

Apply image style on asset image

us flag

I have a static image in my theme folder. Is it possible to apply an image_style to it ?

When I apply the image_style, I have this url that's generated :

/sites/default/files/styles/card_product/public//themes/custom/mytheme/resources/images/widget/myimg.jpg?itok=eIWpocqr

That's how I call it

{% set img = base_path ~ "/" ~ active_theme_path() ~ "/resources/images/widget/myimg.jpg" %}
<img class="" src="{{ img | image_style('card_product') }}" alt="placeholder">

I don't think it's possible, but I'd like to be sure.

Jaypan avatar
de flag
No, I don't believe this is possible. I am fairly sure that image styles can only be applied to files in the public or private directories. Though maybe someone will come up with a workaround.
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.