When getting file urls, we can't use them in previews since they directly download in the file controller. We have to wrap them in img tags for images, or a fake container with a file image for other types. If we allow the user the option of downloading inline,
$file->getUrl('inline'=true)
we can use the function to generate urls that are compatible with Kartiks File Input option
'initialPreviewAsData'=> 'true',
This means that the file input widget can create the preview code automatically by setting the "type" parameter based on the file mime type in initialPreviewConfig.
This pull request adds an optional parameter to getUrl, and handles that in the filecontroller.
It also updates the built in AttachmentsInput to generate the attachments input with better previewConfigs (image, pdf, txt, office, video)
When getting file urls, we can't use them in previews since they directly download in the file controller. We have to wrap them in img tags for images, or a fake container with a file image for other types. If we allow the user the option of downloading inline,
$file->getUrl('inline'=true)
we can use the function to generate urls that are compatible with Kartiks File Input option'initialPreviewAsData'=> 'true',
This means that the file input widget can create the preview code automatically by setting the "type" parameter based on the file mime type in initialPreviewConfig.
This pull request adds an optional parameter to getUrl, and handles that in the filecontroller.
It also updates the built in AttachmentsInput to generate the attachments input with better previewConfigs (image, pdf, txt, office, video)