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

Fixed Uploaded avatar will not be scaled using Imagicks

sonnb

Well-known member
#1
When using Imagick, although the avatar uploading preview shows the scaled avatar and allow us to drap around but when click save, the avatar will not be scaled but just cropped. It will work if I switch back to GD.

Anyone experiencing this?
 

Mike

XenForo developer
Staff member
#2
This works correctly for me. What version of the imagick PECL extension are you using? (And what version of ImageMagick is that using?) It's possible there's a regression in the library.
 

Mike

XenForo developer
Staff member
#4
There was another report of it here and it seemed to be image specific: http://xenforo.com/community/threads/size-of-avatar.64331/#post-679293

I have just found an issue if you're using an old imagick module version - pre-3.0 - as it will fail because of an argument that isn't expected. I'm trying to figure out how to detect that as it's needed for another imagick quirk. However, based on your phpinfo, I don't think that should be affecting you.
 

Mike

XenForo developer
Staff member
#5
Can you try adding the code in green to library/XenForo/Image/ImageMagick/Pecl.php:
Code:
        $oldImagick = version_compare(phpversion('imagick'), '3', '<');

        try
        {
            foreach ($this->_image AS $frame)
            {
                if ($scaleUp)
                {
                    $frame->resizeImage($width, $height, Imagick::FILTER_QUADRATIC, .5, true);
                }
                else if ($oldImagick)
                {
                    // the fill param wasn't added until imagick 3.0 so we can't pass it without an error
                    $frame->thumbnailImage($width, $height, true);
                }
                else
                {
                    $frame->thumbnailImage($width, $height, true, true);
                }
                $frame->setImagePage($width, $height, 0, 0);
            }

            $this->_updateDimensionCache();
        }
        catch (Exception $e)
        {
            XenForo_Error::logException($e, false);
            return false;
        }
And then try adding an image that failed before. Is it working now? If not, check the server error log - is anything logged?