首页  >  问答  >  正文

我对 liip Imagine 有疑问

我使用 symfony 5.4,我只需安装 liip Imagine 包来操作我的图像。但是,配置完所有内容后,我的浏览器中没有出现任何图像,当我检查时,我得到了我的代码,并收到以下错误消息:http://localhost:8000/media/cache/resolve/my_thumb/images /properties/629a464aa81ef086062845.jpg 404(未找到)

在我的项目中,我什至没有在 images 目录中为 media/cache/..... 自动生成任何目录。

这是我的 liip_imagine.yaml 文件的内容:

# Documentation on how to configure the bundle can be found at: https://symfony.com/doc/current/bundles/LiipImagineBundle/basic-usage.html
liip_imagine:
    # valid drivers options include "gd" or "gmagick" or "imagick"
    driver: "gd"

    filter_sets:
        cache : ~
        my_thumb:
            quality: 75
            filters:
                thumbnails: {size: [360, 230], mode: outbound}

这是我在我的树枝文件中写的内容:

<img src="{{ vich_uploader_asset(property, 'imageFile') | imagine_filter('my_thumb') }}" class="card-img-top" alt="">

请我需要帮助,我尝试了几种技巧,例如添加解析器和加载器,但没有一个能解决我的问题

P粉021553460P粉021553460187 天前298

全部回复(1)我来回复

  • P粉649990163

    P粉6499901632024-03-20 17:50:15

    也在配置文件中使用此设置

    resolvers:
        default:
            web_path:
                web_root: ~ # %kernel.project_dir%/public (%kernel.project_dir%/web for Symfony < 4.0.0)
                cache_prefix: ~ # media/cache

    您的文件在哪里生成?您必须使用 public/../media/cache 文件夹为上传的图像路径添加符号链接,然后您将在浏览器中看到图像

    回复
    0
  • 取消回复