如何解决liip_imagine 是否将 jpeg/jpg/png 文件转换为 webp? - symfony php 7.4.9
所以我想将项目中的现有图像从 jpeg/jpg/png 转换为 .webp 扩展名。我已经阅读了使用 immagine for it https://github.com/liip/LiipImagineBundle/pull/1307 的内容,但是 它不起作用,我的 liip_imagine 看起来像这样:
liip_imagine:
driver: "imagick"
default_filter_set_settings:
format: webp
webp:
generate: true
quality: 80
cache: ~
data_loader: ~
post_processors: [ ]
resolvers:
profile_photos:
web_path:
# use %kernel.project_dir%/web for Symfony prior to 4.0.0
web_root: "%kernel.project_dir%/public"
cache_prefix: "media/cache"
filter_sets:
cache: ~
my_thumbnail:
quality: 80
filters:
thumbnail: { mode: inset }
post_processors:
optipng:
strip_all: true
level: 3
my_thumbnail_webp:
format: webp
quality: 80
filters:
thumbnail: { mode: inset }
post_processors:
optipng:
strip_all: true
level: 3
然后我有这个:
<picture>
<source srcset="{{ '/path/to/image.png' | imagine_filter('my_thumbnail_webp') }}" type="image/webp">
<source srcset="{{ '/path/to/image.png' | imagine_filter('my_thumbnail') }}" type="image/png">
<img src="{{ '/path/to/image.png' | imagine_filter('my_thumbnail') }}">
</picture>
但它不起作用!我该如何解决我的问题? 在网站上我仍然有 /path/to/image.png - 所以它不会改变任何东西,我想要 /path/to/image.png.webp 我应该将项目中的每个 img 文件都转换为 webp 并再次上传还是怎样?
解决方法
你快到了!您错过了路径中的 /workspace/images
方法:
docker run --gpus all -v $(pwd)/images:/workspace/images test -i images
所以应该是:
asset
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。