[英]How to preview image file after it is selected, and before uploading on Laravel Nova 4
I would like to know how to preview the image after it is selected, and before submitting the form on Laravel Nova 4?我想知道如何在选择图像后预览图像,然后在 Laravel Nova 4 上提交表单?
# App/Nova/Image.php
/**
* Get the fields displayed by the resource.
*
* @param \Laravel\Nova\Http\Requests\NovaRequest $request
* @return array
*/
public function fields(NovaRequest $request)
{
return [
ID::make()->sortable(),
Image::make('image')->disk('s3')->path('s3-uploads/event_images')->acceptedTypes('image/*'),
];
}
Is it possible to execute custom javascript on a Laravel Nova Form that detects when the image file is selected and inserts a preview in the form?是否可以在 Laravel Nova 表单上执行自定义 javascript,以检测何时选择图像文件并在表单中插入预览? Or is there a simpler / recommended way to do it?或者有更简单/推荐的方法吗?
Thank you谢谢
Dear you can use packages or create custom filed about package I will recommend some package:亲爱的你可以使用包或创建关于包的自定义文件我会推荐一些包:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.