fine-uploader
fine-uploader copied to clipboard
Option to exclude animated gifs from client side scaling
In order to reduce size of sent images I use the client side scale option which works well. Further I chose to not send the original picture in addition to the scaled image.
If however the user uploads an animated gif the scaler creates a (still) jpg from the gif and so I loose the animated gif.
It would be great to have the option to skip scaling of (animated) gifs.
It would be fairly easy to prevent files from being scaled based on file type (i.e. exclude all gifs). Detecting an animated gif client-side is possible, but much more work. We'd need to read the gif file and look for frames. This may result in a read of the entire gif, assuming we don't find more than 1 frame.
So maybe start simple and allow a field of types to exclude from scale.
So maybe start simple and allow a field of types to exclude from scale.
I'm not sure that is a useful feature. But I do see the need to prevent scaling of animated GIFs since the scaled version will not be animated.
Is there any progress on this feature? We also need to exclude Animated Gif from scaling.
This feature is not yet planned for an upcoming release. You can see the plans for the next few releases at https://github.com/FineUploader/fine-uploader/milestones.
Workaround: Exclude all gifs from scale.
For fine-uploader.js,
replace
if (identifier.isPreviewableSync()) {
to
if (originalBlob.type !== "image/gif" && identifier.isPreviewableSync()) {
For fine-uploader.min.js,
replace
return p.isPreviewableSync()?
to
return (o.type!=="image/gif"&&p.isPreviewableSync())?
@shiningdracon that is a not something I would advise doing, and this change will break the source map. a pull request might get this case pushed through into the next release though. I see an option on thumbnails and a matching one on scaling, in addition to the code changes needed to enforce the new options. Probably wouldn't be too hard...
+1, I'd like to just exclude all .gifs from resizing.
@LusciousPear This is currently low on my priority list, but I'd be happy to review and provide advice for a pull request.
I was thinking of a workaround for this issue. Is it possible to use custom resizer for scaling and on seeing image/gif let the file upload as is and for other files use the default/custom behaviour as normal?
If that makes sense, can you suggest code for this please?
@rnicholus makes sense to you as well?
@rnicholus This would be suuper helpful :)
I know this is a really old issue, and I hate bumping, but I'm just wondering if anyone has actually come up with a solution for this. It's really a breaking feature as it means you cannot upload an animated GIF at all.