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

Enable "animated": true in Sharp #409

Open
zawilliams opened this issue Aug 8, 2024 · 0 comments
Open

Enable "animated": true in Sharp #409

zawilliams opened this issue Aug 8, 2024 · 0 comments
Labels

Comments

@zawilliams
Copy link

Sharp has an option to resize with "animated": true or "animated": false in the edits in the base64 edits config. Within the Craft admin, resized .gifs are not animated, but I'd like them to be animated.

If I'm trying to check for file type and setting "animated": true, is the recommended way to do this using a custom image transform class? Like outlined here: https://nystudio107.com/docs/image-optimize/advanced.html#writing-your-own-image-transform-class

If I were inside the SharpImageTransform.php class and modify it like below, I get the animation happening in Craft admin:

if (!empty($edits)) {
    $config['edits'] = $edits;
}
        
$config['edits']['animated'] = true; // new line that could be conditional

Is there another way that I should be going about this?

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

No branches or pull requests

1 participant