1

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

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

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

Twig:( <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 }
4

1 回答 1

1

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

于 2017-02-08T09:22:24.107 回答