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 preview bypass for .gif files #1012

Merged
merged 5 commits into from
Jul 7, 2020
Merged

Added preview bypass for .gif files #1012

merged 5 commits into from
Jul 7, 2020

Conversation

Salzian
Copy link
Contributor

@Salzian Salzian commented Jul 3, 2020

This PR adds a bypass for the preview generation of GIF files. I noticed gif files use the default gif.Encode function which only processes the first frame, making the whole GIF purpose useless. When previewing gif files right now, they're not animated. ☹️

The bypass is only activated for big previews since I thought a bunch of small gif files in a folder view looks silly and is probably not too keen on performance. Also the previews where streched to squares and I didn't want to go down that rabbit hole.

I literally learned Go for this within 2 hours but got it working. After all it's just a simple bypass using another function for gifs. Any feedback and suggestions are greatly appreciated.

I also thought about incorporating the process in the preexisting imgProcessor but it takes multiple seconds(!) to process all frames. I think just handing it out as is, is the better solution here. When you handle gif files you know they're not optimized for size.

Also, maybe this behavior can be hidden behind a settings toggle if desirable. I think previewing gifs in big mode should be animated by default.

http/preview.go Outdated Show resolved Hide resolved
Copy link
Member

@o1egl o1egl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix linter errors

http/preview.go Outdated Show resolved Hide resolved
@o1egl o1egl merged commit 453636d into filebrowser:master Jul 7, 2020
@Salzian Salzian deleted the animated-gif-preview branch July 7, 2020 21:02
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.

None yet

2 participants