fine-uploader icon indicating copy to clipboard operation
fine-uploader copied to clipboard

Option to exclude animated gifs from client side scaling

Open ajorias opened this issue 10 years ago • 13 comments

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.

ajorias avatar Feb 20 '15 15:02 ajorias

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.

rnicholus avatar Feb 20 '15 16:02 rnicholus

So maybe start simple and allow a field of types to exclude from scale.

ajorias avatar Feb 20 '15 20:02 ajorias

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.

rnicholus avatar Aug 05 '15 15:08 rnicholus

Is there any progress on this feature? We also need to exclude Animated Gif from scaling.

arvind-agarwal avatar Mar 11 '16 04:03 arvind-agarwal

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.

rnicholus avatar Mar 11 '16 05:03 rnicholus

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 avatar Aug 09 '16 09:08 shiningdracon

@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...

rnicholus avatar Aug 09 '16 09:08 rnicholus

+1, I'd like to just exclude all .gifs from resizing.

LusciousPear avatar Sep 12 '16 22:09 LusciousPear

@LusciousPear This is currently low on my priority list, but I'd be happy to review and provide advice for a pull request.

rnicholus avatar Sep 12 '16 23:09 rnicholus

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?

sido420 avatar Jan 30 '18 00:01 sido420

@rnicholus makes sense to you as well?

sido420 avatar Jan 30 '18 01:01 sido420

@rnicholus This would be suuper helpful :)

Dayjo avatar Aug 10 '18 11:08 Dayjo

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.

Dayjo avatar Oct 26 '18 08:10 Dayjo