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

XF 1.3 How to disable Gif animations with ImageMagick?

Discussion in 'XenForo Questions and Support' started by Moshe1010, Feb 11, 2014.

  1. Moshe1010

    Moshe1010 Well-Known Member

    I know that most people want to go the other way around, but I use ImageMagick just to have better quality pictures than GD (and there is a huge difference in a good quality pictures).
    The gif animations are just annoying when they are uploaded as an avatar, so I'm wondering how can I disable it without losing ImageMagick completely?

    Thanks.
     
  2. Mike

    Mike XenForo Developer Staff Member

    There's no option that controls that.
     
  3. AndyB

    AndyB Well-Known Member

    Here's what I do.

    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_GIFIMAGETYPE_JPEGIMAGETYPE_PNG)))
    {
        throw new 
    XenForo_Exception(new XenForo_Phrase('uploaded_file_is_not_valid_image'), true);
    }
    Hacked code

    PHP:
    if (!in_array($imageType, array(IMAGETYPE_JPEGIMAGETYPE_PNG)))
    {
        throw new 
    XenForo_Exception(new XenForo_Phrase('uploaded_file_is_not_valid_image'), true);
    }
     
    Moshe1010 likes this.
  4. Moshe1010

    Moshe1010 Well-Known Member

    Is it possible to limit this just for avatars and not for the entire board/image upload?
     
  5. AndyB

    AndyB Well-Known Member

    The hack above that I described only effects uploading gif images for avatars.
     
  6. RobParker

    RobParker Well-Known Member

Share This Page