1. 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?

Discussion in 'Troubleshooting and Problems' started by Rudy, Feb 3, 2015.

  1. Rudy

    Rudy Well-Known Member

    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.


    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.
  2. Tracy Perry

    Tracy Perry Well-Known Member

    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.
  3. Mike

    Mike XenForo Developer Staff Member

    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.
  4. Tracy Perry

    Tracy Perry Well-Known Member

    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: Feb 3, 2015
  5. Mike

    Mike XenForo Developer Staff Member

    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 likes this.
  6. Tracy Perry

    Tracy Perry Well-Known Member

    Wasn't aware that XenForo renamed all uploads of avatars to a JPG. Out of curiosity, is there a reason for that?
  7. Mike

    Mike XenForo Developer Staff Member

    Originally they were converted to JPG. That changed but the file names have been kept.
    Tracy Perry likes this.
  8. Rudy

    Rudy Well-Known Member

    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.
  9. Mike

    Mike XenForo Developer Staff Member

    Those would each require direct code changes -- they're very low level/internal.
    Rudy likes this.
  10. Rudy

    Rudy Well-Known Member

    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.
  11. otto

    otto Well-Known Member


    can you please talk about details? (converting to gif over a server cron)

Share This Page