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

tek_tat6511
tek_tat6511

Hello! How to display pictures in lists ? I use these codes :

Model :

public function getPicturesAttribute()
    {
        $project = $this->find($this->id);
        return '<img src="'.$project->picture->getThumb(50, 50).'" />';
    }

Result in list :

<img src="/storage/app/uploads/public/550/6c0/28b/thumb_11_50x50_0_0_auto.jpg" />

This is just the tag, as it was filtered :(

Last updated

Shahiem
Shahiem

You can change the type of your column to section or partial. That will work.

tek_tat6511
tek_tat6511

Thanks a lot Shahiem, it works fine with section type in columns.yaml

devnull69
devnull69

admin_column:
    label: admin
    description: admin rights
    disabled: false
    span: right
    hidden: false
    type: section
      path: ~/plugins/devnull/robot/models/robot/_content_column.htm

for me this doesnt come up anything

//_content_column.htm

<a class="btn btn-sm btn-info" href="robots/update/{% slug %}"><i class="icon-pencil"></i> Edit</a>
<a class="btn btn-danger" href="#"><i class="icon-trash icon-large"></i> Delete</a>

what is wrong ?

Last updated

axomat
axomat

Try type: partial. This works for me for example

    images:
        label: Images
        relation: images
        type: partial
        path: ~/plugins/me/myplugin/models/mymodel/_image_column.htm

Last updated

Troiscent
Troiscent

@axomat

What do you put in your partial to render the image ?

kevin.rabello9355
kevin.rabello9355

@Troiscent

try something like this

<img src="/storage/app/media/<?php echo $value; ?>">

in ~/plugins/me/myplugin/models/mymodel/_image_column.htm

Last updated

1-7 of 7

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