在liip想象中错误的图像路径

时间:2017-02-07 10:17:23

标签: symfony liipimaginebundle vichuploaderbundle

我使用vich上传器上传图片和oneup flysystem文件抽象。另外liip想象捆绑制作缩略图。

问题是liip采用我的oneup flysystem适配器本地路径并尝试在其中查找uploads/58998d6502406.png图像。当我删除uploads前缀时,它会工作,抛出源文件未找到异常。

也许我在配置中遗漏了一些东西?

嫩枝: <img src="{{ vich_uploader_asset(partner, 'imageFile') | imagine_filter('my_thumb') }}" />(也尝试过资产)

生成的网址: http://app.dev/media/cache/resolve/my_thumb/uploads/58998d6502406.png

有效的网址: http://app.dev/media/cache/resolve/my_thumb/58998d6502406.png

我的配置:

# OneupFlysystem Configuration
oneup_flysystem:
    adapters:
        uploads_adapter:
            local:
                directory: "%kernel.root_dir%/../web/uploads"
    filesystems:
        uploads_fs:
            adapter: uploads_adapter
            mount:   uploads_fs

# Vich uploader Configuration
vich_uploader:
    db_driver: orm
    storage:   flysystem
    mappings:
        partner_image:
            uri_prefix: /uploads
            upload_destination: uploads_fs
            namer: vich_uploader.namer_uniqid
            delete_on_remove: true
            delete_on_update: true
        news_image:
            uri_prefix: /uploads
            upload_destination: uploads_fs
            namer: vich_uploader.namer_uniqid
            delete_on_remove: true
            delete_on_update: true

# Liip imagine bundle Configuration
liip_imagine:
    loaders:
        uploaded_images:
            flysystem:
                filesystem_service: oneup_flysystem.uploads_fs_filesystem
    data_loader: uploaded_images
    filter_sets :
        my_thumb:
            filters:
                thumbnail: { size: [120, 90], mode: outbound }

1 个答案:

答案 0 :(得分:0)

通过将vich上传器配置中的uri_prefix更改为空字符串uri_prefix: ""来修复