Ghost/ghost/core
Simon Backx b7f3892be0
Added format option to img-url helper (#14962)
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>
```
2022-08-01 14:45:54 +02:00
..
content 🎨 Updated Casper to v5.2.2 2022-07-26 08:23:54 +01:00
core Added format option to img-url helper (#14962) 2022-08-01 14:45:54 +02:00
test Added format option to img-url helper (#14962) 2022-08-01 14:45:54 +02:00
.c8rc.json Converted Ghost repo into a monorepo 2022-07-20 16:41:05 +02:00
.eslintignore Converted Ghost repo into a monorepo 2022-07-20 16:41:05 +02:00
.eslintrc.js Converted Ghost repo into a monorepo 2022-07-20 16:41:05 +02:00
.gitignore Converted Ghost repo into a monorepo 2022-07-20 16:41:05 +02:00
.npmignore Converted Ghost repo into a monorepo 2022-07-20 16:41:05 +02:00
config.development.json Converted Ghost repo into a monorepo 2022-07-20 16:41:05 +02:00
ghost.js Converted Ghost repo into a monorepo 2022-07-20 16:41:05 +02:00
Gruntfile.js Moved yarn main functionality up to root yarn script 2022-07-25 18:30:21 +02:00
index.js Converted Ghost repo into a monorepo 2022-07-20 16:41:05 +02:00
jsconfig.json Converted Ghost repo into a monorepo 2022-07-20 16:41:05 +02:00
loggingrc.js Converted Ghost repo into a monorepo 2022-07-20 16:41:05 +02:00
MigratorConfig.js Converted Ghost repo into a monorepo 2022-07-20 16:41:05 +02:00
package.json Added format option to img-url helper (#14962) 2022-08-01 14:45:54 +02:00