vich uploader 和 easy admin 图片不显示
vich uploader and easy admin images not showing
我正在学习来自 (https://symfony.com/doc/master/bundles/EasyAdminBundle/integration/vichuploaderbundle.html)
的教程
我可以上传图片,但它没有出现在 easy-admin 的列表视图中。
它是这样的:
#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' }
上传文件的路径如下:
#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 所有这些相关技术,所以我在这里有点迷路。
你应该把你的图片放在public文件夹下,试试这个映射配置:
manchete_images:
uri_prefix: '%app.path.manchete_images%'
upload_destination: '%kernel.project_dir%/public/%app.path.manchete_images%'
是的,多亏了@Ahmed 的建议,它现在显示...
认为 uri_prefix 应该包含单引号,否则会发生异常...
像这样:
manchete_images:
uri_prefix: '%app.path.manchete_images%'
upload_destination: '%kernel.project_dir%/public/%app.path.manchete_images%'
再次感谢...
我正在学习来自 (https://symfony.com/doc/master/bundles/EasyAdminBundle/integration/vichuploaderbundle.html)
的教程我可以上传图片,但它没有出现在 easy-admin 的列表视图中。
它是这样的:
#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' }
上传文件的路径如下:
#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 所有这些相关技术,所以我在这里有点迷路。
你应该把你的图片放在public文件夹下,试试这个映射配置:
manchete_images:
uri_prefix: '%app.path.manchete_images%'
upload_destination: '%kernel.project_dir%/public/%app.path.manchete_images%'
是的,多亏了@Ahmed 的建议,它现在显示... 认为 uri_prefix 应该包含单引号,否则会发生异常...
像这样:
manchete_images:
uri_prefix: '%app.path.manchete_images%'
upload_destination: '%kernel.project_dir%/public/%app.path.manchete_images%'
再次感谢...