• 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?

Moshe1010

Well-known member
#1
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.
 

AndyB

Well-known member
#3
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_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);
}
 

Moshe1010

Well-known member
#4
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_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);
}
Is it possible to limit this just for avatars and not for the entire board/image upload?