This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
I have created a plugin and I would like to use the media manager in order to select an image and to save the file path in my model. I have added
featured_image: label: trt.events::lang.models.event.featured_image type: mediafinder mode: file
to my fields.yaml file. In the back-end I am able to open the media manager and to select an image. However, I can't figure out how to save the file path. In my model class I am using this code.
public $attachOne = [ 'featured_image' => ['System\Models\File'] ];
I guess the above code is incorrect but I can't find any other references. Any help would be really appreciated. Thank you.
You dont need to setup the $attachOne relation, this is used by the fileupload
form widget.
Remove it and instead add a text/string column featured_image
to your table. That will contain a relative path to the image once you select an image using the Media Manager.
When I want to display and image from the fileupload form widget, how do I do that?
Can I crop it before it is served to a http request?
Last updated
1-5 of 5