eigotec - 2 months ago

Hi, For a page i have made in the CMS i have given it an image upload field. I want to render that image on the page. So far i have tried: {{ template.page.card_image_field_1 }} with many variations including the raw postfix How can i output an image in to the template, that has been uploaded via the CMS?


ryanthompson - 2 months ago

Check out https://pyrocms.com/documentation/upload-field-type for more information but it's returning a file instance. Which you can use as is or call make on to return an IMAGE instance and really get to work. To render the image most simply put do this:

{{ template.page.card_image_field_1.make|raw }} // Defaults to image output
{{ template.page.card_image_field_1.make.path|raw }} // Path example

You can learn more about the image instance here: https://pyrocms.com/documentation/streams-platform/1.3/services/image

ryanthompson - 2 months ago

Looks like file module docs are a little screwy but I'll sort it out. Keep an eye on: https://pyrocms.com/documentation/files-module