• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Server issue Animated Avatars

Wuebit

Well-known member
#1
Howdy.

On my test site I have attachments limit set to 10mb and the size show when uploading is 200x200px

Ive just uploaded a Gif file and it does not move (as in no animation)
I even tried to upload it though the admin panel editing the user with the same result.

I also tested a smaller image (less than 200x200) and it worked fine.

I also get no errors so can't provide one.

To reproduce just upload a 200x200 animated Gif image.
 

Mike

XenForo developer
Staff member
#2
To maintain animation with resized images, you need to use ImageMagick as your image processor. GD doesn't support animation.
 

Wuebit

Well-known member
#6
Mike when uploading a a gif not as an avatar but on a post does imagemagick make the thumb?
Also when uploading a none gif with imagemagick selected as the default image processor does GD make this thumb?
 

Mike

XenForo developer
Staff member
#7
Whenever a image needs to be processed (resized, etc) for any reason, your selected image processor is used.
 

Wuebit

Well-known member
#8
Whenever a image needs to be processed (resized, etc) for any reason, your selected image processor is used.
Than I think I have some problem here.
Any image other than a Gif will work fine but if I upload a Gif it get's stuck on 100%
 

Mike

XenForo developer
Staff member
#9
It's possible there are issues with ImageMagick, but equally, this is one of the tradeoffs. If you resize an animated image, it's like resizing a large number of images (each frame is resized), so it can trigger timeouts/memory issues more easily.
 

AndyB

Well-known member
#12
I'll have a look into it than. On a off note is there a way to disable animated avatars all together?
What I have done on my forum is disable uploading of .gif for avatars.

You can make a simple hack in the core file like this:

library/Xenforo/Model/Avatar.php

this hack prevents gif's from being uploaded as an avatar.

Line 59

Original code
=============
PHP:
if (!in_array($imageType, array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG)))
{
    throw new XenForo_Exception(new XenForo_Phrase('uploaded_file_is_not_valid_image'), true);
}
Hacked code
===========
PHP:
if (!in_array($imageType, array(IMAGETYPE_JPEG, IMAGETYPE_PNG)))
{
    throw new XenForo_Exception(new XenForo_Phrase('uploaded_file_is_not_valid_image'), true);
}