我正在使用树枝局部视图在我的网站上生成缩略图,看起来像这样。
<picture class="{{ class }}">
<source data-srcset="{{ src |resize(width,height)|towebp(90) }}" type="image/webp">
<img
src="{{ placeholder(width,height) }}"
data-src="{{ src|resize(width,height) }}"
class="w-full h-auto lazyload"
alt="{{ alt }}"
width="{{ width }}"
height="{{ height }}"
{% if styles %} style="{{ styles }}" {% endif %}>
</picture>
此模板的问题在于,如果遇到相同大小的原始图像,则会对其调整大小并增大文件大小,如果width和height参数与原始图像相同,是否可以忽略调整大小过滤器? 同样,如果我使用类似的过滤器将jpeg转换为webp,则它会使webp图像的大小大约是原始jpeg的3倍,您知道是什么原因引起的吗?