Animated GIFs no longer Animated in 3.30

6 years ago
I have run into an interesting issue where all the animated GIF images that we upload become flat images. Even when the images are previewed. In 3.00 the images were flattened for all resized thumbnails, however in 3.30 the images are flat regardless of where they are displayed.
6 years ago
Same happens in 3.4 regardless if stored in DB or Filesystem.

is there any word on this? Need support for Animated Gifs please.
6 years ago
We managed to resolve this using http://imageresizing.net/plugins/animatedgifs.

Ensure the DLLs are in the Admin/bin folder.
4 years ago
Anyone can help me how to use the imageresizer animatedgif dll?
I installed it from nuget, but I have no idea how to save the animating gifs
4 years ago
Hi finianex,

This is not a NOP plugin, but rather a plugin for visual studio. You would need to tweak the code that allows for image uploads. Unfortunately I have not dug in more than that. We upload a GIF, then we replace the GIF image(s) in the thumbs directory to show the animation on our NOP site. This is because by default, .NET will flatten the image(s) that are uploaded and will not retain the animation. Sorry I can't be more help... Maybe future releases of NOP will allow for animated GIF uploads with appropriate resizing.
4 years ago
Thank you for your reply, after many hours research...

I change the media services code, in the Nop.Service -> Media ->  PictureService.cs
maybe it's not the best way, but the .gif animated, hope to help someone.

        public virtual byte[] ValidatePicture(byte[] pictureBinary, string mimeType)
        {
            //here  i skip the compression... and return the original picture
            if (mimeType.Contains("gif"))
            {
                return pictureBinary;
            }

            using (var destStream = new MemoryStream())
            {
                ImageBuilder.Current.Build(pictureBinary, destStream, new ResizeSettings
                {
                    MaxWidth = _mediaSettings.MaximumImageSize,
                    MaxHeight = _mediaSettings.MaximumImageSize,
                    Quality = _mediaSettings.DefaultImageQuality
                });
                return destStream.ToArray();
            }
        }
4 years ago
Thank you for posting that fix.   It worked for me in 3.7
4 years ago
finianex wrote:
Thank you for your reply, after many hours research...

I change the media services code, in the Nop.Service -> Media ->  PictureService.cs
maybe it's not the best way, but the .gif animated, hope to help someone.

        public virtual byte[] ValidatePicture(byte[] pictureBinary, string mimeType)
        {
            //here  i skip the compression... and return the original picture
            if (mimeType.Contains("gif"))
            {
                return pictureBinary;
            }

            using (var destStream = new MemoryStream())
            {
                ImageBuilder.Current.Build(pictureBinary, destStream, new ResizeSettings
                {
                    MaxWidth = _mediaSettings.MaximumImageSize,
                    MaxHeight = _mediaSettings.MaximumImageSize,
                    Quality = _mediaSettings.DefaultImageQuality
                });
                return destStream.ToArray();
            }
        }


Hi what else did you do to fix this?

Did you install anything else?

I updated the code and uploaded all my bin folder but no lucky.

I am trying to put an animated gif on my blog post.

Can you please assist?
2 years ago
Bumping this because i can maybe add some good info.

We have NopCommerce 3.9 with the NivoSlider plugin.
Here, adding the above mentioned line
 if (mimeType.Contains("gif")) { return pictureBinary; } 

does make it possible to include animated gifs on the plugin's slides, without any further changes necessary.

The problem is that this change also disables the picture resizing for gifs (also for non-animated gifs), which means you will not be able to see animated gifs for products if a specific size is set for product pictures in the picture settings. (Except if they have that size exactly, probably.)
In any place within your webshop where you can place pictures, where there is no specific size setting, it should be possible to place animated gifs too.

To be able to add animated gifs of any size as product pictures, you must do the following:
To see the gif in the product list (for example when clicking a product category, or when "display on homepage" is selected for this product), in the picture settings you have to set product preview picture size to zero.
To see the gif in the product details page, in the picture settings you have to set product details picture size to zero.
To see it in both places, you have to set both values to zero.

A possible workaround (we did not try it but it should work) would be to always use animated gifs of the exact size specified in the picture settings, but then you would have to set preview picture size to the same number as details picture size to be able to see the same animated gifs in both places.
(Note that no matter how you set this, it always requires square pictures, length and width equal.)
8 months ago
i am using 3.9 and for bannner i am using this "SevenSpikes.Nop.Plugins.AnywhereSliders" plugin so where i have to add "if (mimeType.Contains("gif")) { return pictureBinary; }" this code ?