Community guidelines
Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.
Cedric W Member
@horussky · Joined 8 years ago · 34 posts · 7 topics · 2 reputation
Badges
Recent posts
-
How to dynamically access images from upload field from an images folder inside of theme?
· 8 years ago
@paul unfortunately no... for whatever reason, page.media or media[] does not render an image within that forloop. When adding the following to the dump {{ feature.media[header.overview.homepage_i
-
How to dynamically access images from upload field from an images folder inside of theme?
· 8 years ago
So taking a different approach I was able to output the images like so: <img src="{{ '/' ~ feature.header.overview.homepage_img|first.path }}" /> So in my Loop, it looks like this {% set this
-
How to dynamically access images from upload field from an images folder inside of theme?
· 8 years ago
@paul unfortunately none of these worked {% for feature in page.find('/events').children() %} {% set image = feature.header.overview.homepage_img %} {{ feature.media[image|first.na
-
How to dynamically access images from upload field from an images folder inside of theme?
· 8 years ago
@paul yeah these lines results in nothing as well {% for feature in page.find('/events').children() %} {% set image = feature.header.overview.homepage_img %} {{ p
-
How to dynamically access images from upload field from an images folder inside of theme?
· 8 years ago
@paul Cool. Here's the results from some testing.... {% for feature in page.find('/events').children() %} {% set image = feature.header.overview.homepage_img %} {{ image|first.size }} <<
-
How to dynamically access images from upload field from an images folder inside of theme?
· 8 years ago
@paul: Take a look at this cookbook entry: https://learn.getgrav.org/cookbook/twig-recipes#displaying-an-image-uploaded-in-a-file-field Example: {{ page.media[header.yourfilefield|first.name] }} @pau
-
How to dynamically access images from upload field from an images folder inside of theme?
· 8 years ago
@RobLui: {% for image in page.header.homepage_img %} {{ media[‘theme://images/featured/’ ~ image ~].html() }} {% endfor %} Hey Rob, This example code didn't work either. Still produced an error. Une
-
How to dynamically access images from upload field from an images folder inside of theme?
· 8 years ago
@hugoaf: {{ media['theme://images/featured/' ~ page.header.homepage_img].html() ] }} Hey Hugoaf, thanks for the response, however, your example results in an error. One because there is an extra "]"
-
How to dynamically access images from upload field from an images folder inside of theme?
· 8 years ago
So I know this works -- explicitly calling the image file. {{ media['theme://images/featured/featured-event-efw.jpg'].html() }} however I need a more dynamic approach, because I want to loop through
-
How to dynamically access images from upload field from an images folder inside of theme?
· 8 years ago
So I've ran into an issue where I'm not able to pull the image from an custom upload field. Note: The destination is in a custom folder and the images are uploading fine on the backend. Blueprint: he