我遇到了问题,如果有人知道发生了什么,请提供帮助, 我正在按照(https://symfony.com/doc/master/bundles/EasyAdminBundle/integration/vichuploaderbundle.html)
中的教程进行操作我能够上传图片,但是它没有出现在easy-admim的列表视图中
它是这样的:
#easy_admin.yaml
easy_admin:
entities:
Manchete:
class: App\Entity\Manchete
form:
fields:
- titulo
- descricao
- link
- { property: 'arquivoDaImagem', type: 'vich_image', base_path: '%app.path.manchete_images%',
help: 'selecione uma imagem para a manchete',
, label: 'Imagem da manchete', template: 'vich_uploader_image.html.twig' }
# ...
list:
fields:
- titulo
- descricao
- link
- { property: 'imagem', template: 'vich_uploader_image.html.twig' }
# ...
show:
fields:
- titulo
- descricao
- link
- { property: 'imagem', template: 'vich_uploader_image.html.twig' }
bellow是上传文件的路径->
#vich_uploader.yalm
vich_uploader:
db_driver: orm
mappings:
manchete_images:
uri_prefix: '%app.path.manchete_images%'
upload_destination: '%kernel.project_dir%/%app.path.manchete_images%'
#services.yaml
parameters:
locale: 'en'
app.path.manchete_images: /uploads/images/manchetes
文件和图像正在上传到文件夹:
但是没有显示在简单的管理员视图中
所以这是我第一次使用symfony所有这些相关技术,所以我在这里有点迷路了...
在此先感谢您的回复...
答案 0 :(得分:3)
您应将图像放在 public 文件夹下,尝试以下映射配置:
manchete_images:
uri_prefix: '%app.path.manchete_images%'
upload_destination: '%kernel.project_dir%/public/%app.path.manchete_images%'
答案 1 :(得分:0)