mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 01:41:46 +03:00
b7f3892be0
fixes https://github.com/TryGhost/Ghost/issues/14323 - Fixed support for resizing images from Unsplash using the `img-url` helper (previously the size property was ignored for images from Unsplash) - Added support for `avif` file formats (supported by sharp out of the box) - Added support for setting the format of images, with a new `format` option: E.g. to convert an image to webp (only works in combination with size for now, except for Unsplash where you can use it without size): ``` {{img_url @site.cover_image size="s" format="webp"}} ``` This can help improve the performance of a theme, by serving assets in `<picture>` elements with webp and fallback image formats. Usage example: ```html <picture> <source srcset="{{img_url feature_image size="s" format="avif"}} 300w, {{img_url feature_image size="m" format="avif"}} 600w, {{img_url feature_image size="l" format="avif"}} 1000w, {{img_url feature_image size="xl" format="avif"}} 2000w" sizes="(min-width: 1400px) 1400px, 92vw" type="image/avif" > <source srcset="{{img_url feature_image size="s" format="webp"}} 300w, {{img_url feature_image size="m" format="webp"}} 600w, {{img_url feature_image size="l" format="webp"}} 1000w, {{img_url feature_image size="xl" format="webp"}} 2000w" sizes="(min-width: 1400px) 1400px, 92vw" type="image/webp" > <img srcset="{{img_url feature_image size="s"}} 300w, {{img_url feature_image size="m"}} 600w, {{img_url feature_image size="l"}} 1000w, {{img_url feature_image size="xl"}} 2000w" sizes="(min-width: 1400px) 1400px, 92vw" src="{{img_url feature_image size="xl"}}" alt="{{#if feature_image_alt}}{{feature_image_alt}}{{else}}{{title}}{{/if}}" > </picture> ``` |
||
---|---|---|
.. | ||
apps | ||
helpers | ||
meta | ||
services | ||
utils | ||
web/middleware |