This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

Tschallacka
Tschallacka

So you have have added a file uploader/image uploader to your form, and they get attached properly etc...

But now you wish to display them. This is how to do that.

In a direct image display:

fields.yaml

 image:
     type:partial
     path: ~/yea/somewhere/_partialfilename.htm

_partialfilename.htm

<img src="<?php echo $value['path']; ?>">

If the image is part of a relation:

fields.yaml

 relationfieldname:
       type: partial
       path: ~/yea/somewhere/_partialfilename.htm

_partialfilename.htm

   <img src="<?php echo $value->imagefieldname['path']; ?>">

This is assuming you are having attachOne relationship defined here.

If you have attachMany you'll have to loop through them.

   foreach($value->imagefieldname as $img) {
           echo '<img src=' .$img['path'] .'>';
   }

Last updated

1-1 of 1

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.