Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added 'format' to magic actions for images - this will allow conversion and caching of webp images #3144

Merged
merged 1 commit into from
Jan 11, 2021

Conversation

angusmcb
Copy link
Contributor

A very simple change that would make it possible to set the output format of an image from Twig / Markdown.

This would be particularly useful for being able to serve automatically generated webp images, created from jpegs.

Related to issue #1168

@NicoHood
Copy link
Contributor

Very nice idea! How would the twig code look like then? I was searching for such an option some time ago.

@rhukster rhukster merged commit d7378f8 into getgrav:develop Jan 11, 2021
@angusmcb
Copy link
Contributor Author

@NicoHood It works like this:

{{ page.media['sample-image.jpg'].format('webp').url|e }}

@NicoHood
Copy link
Contributor

NicoHood commented Jan 12, 2021

This does not work with derivatives. It only changes the main image to webp, but not the others in srcset. I guess this is a general issue, as quality also does not seem to work for images in srcset.

Edit: Moved discussion/bug here: #3146

@apokaliptis
Copy link

Any idea when this feature will hit a stable release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants