gpt4 book ai didi

symfony - VichUploaderBundle 和 AvalancheImagineBundle

转载 作者:行者123 更新时间:2023-12-04 21:20:28 24 4
gpt4 key购买 nike

我使用 VichUploaderBundle 上传我的媒体文件,我想使用 AvalancheImagineBundle 在我的模板中创建拇指。
应该怎么做?

我现在有这个:

<td><img src="{{ vich_uploader_asset(entity, 'image') | apply_filter('my_thumb')}}" alt="{{ entity.nombre }}" /></td>

但输出是:
<img src="/app_dev.php/media/cache/my_thumb/images/uploads/392158_10150441208223772_580903771_8591661_774015725_n.jpg" alt="Froga"/>

这是我的 config.yml:
# Vich Uploader
vich_uploader:
db_driver: orm
twig: true
gaufrette: false # set to true to enable gaufrette support
storage: vich_uploader.storage.file_system
mappings:
uploads:
uri_prefix: /images/uploads
upload_destination: %kernel.root_dir%/../web/images/uploads
namer: ~ # specify a file namer service id for this entity, null default
directory_namer: ~ # specify a directory namer service id for this entity, null default
delete_on_remove: true # determines whether to delete file upon removal of entity
inject_on_load: true # determines whether to inject a File instance upon load

avalanche_imagine:
source_root: %kernel.root_dir%/../web/images/uploads
web_root: %kernel.root_dir%/../web/images/uploads
cache_prefix: media/cache
driver: gd
filters:
my_thumb:
type: thumbnail
options: { size: [120, 90], mode: outbound, quality: 100, format: png }

任何帮助或线索?

最佳答案

如果您遇到的问题是没有显示图像,那么我遇到了同样的问题。

为了解决它,我确保在我的 config.yml 中,source_rootweb_root avalanche_imagine 的选项设置为 %kernel.root_dir%/../web (或您的网络根目录)。这是我的 config.yml 中的相关片段:

#Uploads
knp_gaufrette:
adapters:
article_adapter:
local:
directory: %kernel.root_dir%/../web/images/articles
filesystems:
article_image_fs:
adapter: article_adapter
vich_uploader:
db_driver: orm
gaufrette: true
storage: vich_uploader.storage.gaufrette
mappings:
article_image:
uri_prefix: /images/articles
upload_destination: article_image_fs
namer: vich_uploader.namer_uniqid

#images
avalanche_imagine:
filters:
article_list:
type: thumbnail
options: { size: [100, 100], mode: outbound }
source_root: %kernel.root_dir%/../web
web_root: %kernel.root_dir%/../web
cache_prefix: cache

关于symfony - VichUploaderBundle 和 AvalancheImagineBundle,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12826071/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com