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

Mosaico fails on animated .GIFs #285

Closed
MegaphoneJon opened this issue Dec 18, 2018 · 9 comments
Closed

Mosaico fails on animated .GIFs #285

MegaphoneJon opened this issue Dec 18, 2018 · 9 comments

Comments

@MegaphoneJon
Copy link
Contributor

Mosaico can't handle uploaded animated GIFs because it fails on resize.

I wrote a patch but I'm using 2.0beta4 in production, not master - and this function has been refactored into another file.

For others looking for a solution, my commit is here: MegaphoneJon@0b9e25c. I'm going to let my users test this in production and if it looks good I'll rewrite it against master.

@deepak-srivastava
Copy link
Collaborator

Hi @MegaphoneJon, this is interesting and must have 👍

I tried applying your patch on latest repo. I do see resized gif images being rendered but not animate.
Do you expect same results or you expect them to animate as well?

@MegaphoneJon
Copy link
Contributor Author

MegaphoneJon commented Dec 19, 2018

They animate for me - though I think I'm losing the animation timing of the original. I think I'll need to add getImageDelay and setImageDelay to preserve original timing.

During my testing I was accidentally creating non-animated GIFs - one trick I used was to run identify on the command line to see how many frames were in the converted GIF so I didn't need to view the GIF to test.

@deepak-srivastava
Copy link
Collaborator

I've created a new branch (animated-gifs) with your changes applied - https://github.com/veda-consulting/uk.co.vedaconsulting.mosaico/compare/animated-gifs?expand=1
Seems like i might have missed something as i don't see the animation.

Feel free to PR experimental code to it, so we can feedback as well.

Thanks.

@MegaphoneJon
Copy link
Contributor Author

@deepak-srivastava While generally I support the move to Intervention/image, it doesn't support animated GIFs: Intervention/image#176

I asked on that thread where the development branch is. While I'd rather not build both a gd-based and imagick-based solution to this, I would be willing to patch one in if I can steal it from the dev branch...

@francescbassas
Copy link
Contributor

@mattwire this issue was closed but has not been resolved, right? It's still not possible to add animated gifs, is it? @MegaphoneJon MegaphoneJon@0b9e25c are you still using this patch? It works?

@MegaphoneJon
Copy link
Contributor Author

@francescbassas Originally, this extension had different code written for folks with ImageMagick installed and folks with GD installed.

At some point, it was replaced with Intervention Image, an abstraction layer that supports both ImageMagick and GD. Unfortunately, Intervention Image doesn't support animated GIFs.

I haven't used my patch in a long time, but to test it, you need to go to Administer » CiviMail » Mosaico Settings and from Mosaico graphics driver select (Deprecated) Direct ImageMagick API. It probably still works because the deprecated code is unlikely to have changed.

@francescbassas
Copy link
Contributor

StackExchange related discussion here https://civicrm.stackexchange.com/questions/34427

@MegaphoneJon
Copy link
Contributor Author

@francescbassas there's a dirty trick to use if you absolutely must have an animated GIF. Create the mailing as you normally would. After saving, find the static GIF in your file system and upload a copy via SFTP or similar. By uploading directly, you bypass intervention/image.

@francescbassas
Copy link
Contributor

francescbassas commented Feb 22, 2024

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

No branches or pull requests

4 participants