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

Fixed  Thumbnail with width/height < 1 pixel

#1
Hey there,

While trying to import vb attachments, I got a "server error" and it halted. In debug mode, I got more info about the error:
imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions
After some debugging, I noticed, the problem is library/xenforo/image/gd.php in line
$newImage = imagecreatetruecolor($width, $height);

Apparently if image is very tiny and has a 0.x width or height, imagecreatetruecolor is rounding it to 0 and dieing with error.

So adding this line right above it fix the problem:
Code:
        // Logician Fix : Import Bug for pictures that have 0.xx dimensions
        if ($width < 1)
        {
            $width = 1;
        }
        if ($height < 1)
        {
            $height = 1;
        }
        // Logician Fix : Import Bug for pictures that have 0.xx dimensions
FYI.

BTW. IMO you should consider giving write access to coders in community support forums. I don't have xenforo myself so I can't get my account associated with a license to get posting permissions but I'm doing work for one of my clients so have still things to report there. If you can implement a vb member area like feature where a license owner can associate multiple forum user accounts with his license, it will be helpful.
 

Mike

XenForo developer
Staff member
#4
BTW, there is a "forum users" part of the customer area. Your client can add your user name there.