October CMS media finder

断了今生、忘了曾经 提交于 2019-12-08 09:07:11

问题


I have recently created a plugin (using the 'builder plugin') where I have a field for attaching images (using 'media finder widget'). Everything is working fine - I can upload an image or choose one from the media library. After successful saving, when I go back to the recently saved record, the image isn't shown... How can I fix this?

Thanks!


回答1:


'media finder widget' not working with relation type 'file attachment', like this:

public $attachOne = [
   'avatar' => 'System\Models\File'
];

try to use another type (for example: json)




回答2:


Try to see this video

Maybe she can help you




回答3:


From what I found the media finder doesn't save the image in a relationship but records the URL of the image from the media library, this is why using:

public $attachOne = [
   'avatar' => 'System\Models\File'
];

Doesn't work. you actually have to add a field in the DB to record the image path.

If someone else has a better solution go with them, but this allowed me to keep the image.



来源:https://stackoverflow.com/questions/47078147/october-cms-media-finder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!