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

XF 1.4 Animated avatar possible?

Rudy

Well-known member
#1
I thought that the way images were uploaded and processed, that any animated avatars (via GIFs) would be converted to JPG and, therefore, not animated. We are using the GD image handling.

Am I mistaken? Or did I miss a setting somewhere? Or can they bypass this by exploiting the .jpg extension (in other words, renaming an animated GIF with a .jpg extension)?

We have a user whose avatar is animated.

http://forums.stevehoffman.tv/data/avatars/l/16/16066.jpg?1355693200

I just want to let the staff know so they can manually remove any avatars such as these. It only shows up as animated in their member card, or in their profile.
 

Tracy Perry

Well-known member
#2
I thought that the way images were uploaded and processed, that any animated avatars (via GIFs) would be converted to JPG and, therefore, not animated. We are using the GD image handling.

Am I mistaken? Or did I miss a setting somewhere? Or can they bypass this by exploiting the .jpg extension (in other words, renaming an animated GIF with a .jpg extension)?
I'm using ImageMagick, so not sure if GD will make a difference or not, but I downloaded that image (and kept the JPG extension) and then tried to use it as an avatar on my site.
This is what it gave me

Screen Shot 2015-02-03 at 1.12.28 AM.png

Just for SaG I kicked over to GD as the image processor.
This is what I got then
Screen Shot 2015-02-03 at 1.15.31 AM.png

So it should be doing the same on your forum (just in case caching hadn't taken effect, I restarted my HTTP server). Additionally, I'm using a Debian based VPS instance for my site.
 

Mike

XenForo developer
Staff member
#3
Animation will be kept if the original image doesn't need to be resized (as in the large image case here). Effectively what they upload will be maintained in that case.

Using Imagick is needed to resize the avatar and generate the other sizes and still maintain animation.
 

Tracy Perry

Well-known member
#4
Animation will be kept if the original image doesn't need to be resized (as in the large image case here). Effectively what they upload will be maintained in that case.

Using Imagick is needed to resize the avatar and generate the other sizes and still maintain animation.
That's weird... the image I have downloaded is an 11,003 byte JPEG extension image (the one he linked to)
My user group has unlimited size for avatars set:
Screen Shot 2015-02-03 at 3.39.02 AM.png
so, by that token it should not have resized it and the animation should have been kept?
In both cases I got that the contents didn't match the extension. I guess that data could have been cached (I do use Memcached) but I had rebooted the HTTP server (which also restarts the PHP processor).

I'll reboot the VPS VM to see if it could have been something stuck in the cache (after enabling GD before the reboot). Now you have me curios why I got the error both times with the same image and no resizing having to be done.
 
Last edited:

Mike

XenForo developer
Staff member
#5
If it has animation, it'll be a GIF file. XF just saves all avatars with a jpg extension. The error you're getting is just part of the upload system itself; no avatar code involved.
 

Tracy Perry

Well-known member
#6
If it has animation, it'll be a GIF file. XF just saves all avatars with a jpg extension. The error you're getting is just part of the upload system itself; no avatar code involved.
Wasn't aware that XenForo renamed all uploads of avatars to a JPG. Out of curiosity, is there a reason for that?
 

Rudy

Well-known member
#8
Interesting. Thanks for the feedback! Is there a way to change them all to JPGs as in the past, or would it involve getting into the code more deeply? Or, could I specifically disallow GIFs to be uploaded at all, or is that too closely tied to the attachment management system?

Sorry I'm all questions today. I was comfortable in the past knowing we'd not have animated avatars on the forum anymore.
 

Rudy

Well-known member
#10
I have another idea outside of the forum software: run a script using a cron task to run identify (part of ImageMagick) to find out the true image type, then run convert if GIF is found. Not ideal, but if I could run it overnight or every few hours, that would take care of most of it for us.