public function changeDimensions($sourceImage, $desiredWidth, $desiredHeight)
    {
        $temp = '';
        // find the height and width of the image
        if (imagesx($sourceImage) >= imagesy($sourceImage)
            && imagesx($sourceImage) >= $this->fixedWidth
        ) {
            $temp = imagesx($sourceImage) / $this->fixedWidth;
            $desiredWidth = imagesx($sourceImage) / $temp;
            $desiredHeight = imagesy($sourceImage) / $temp;
        } elseif (imagesx($sourceImage) <= imagesy($sourceImage)
            && imagesy($sourceImage) >= $this->fixedHeight
        ) {
            $temp = imagesy($sourceImage) / $this->fixedHeight;
            $desiredWidth = imagesx($sourceImage) / $temp;
            $desiredHeight = imagesy($sourceImage) / $temp;
        } else {
            $desiredWidth = imagesx($sourceImage);
            $desiredHeight = imagesy($sourceImage);
        }

        // create a new image
        $thumbImg = imagecreatetruecolor($desiredWidth, $desiredHeight);
        $imgAllocate = imagecolorallocate($thumbImg, 255, 255, 255);
        imagefill($thumbImg, 0, 0, $imgAllocate);

        //copy source image to resize
        imagecopyresampled(
            $thumbImg,
            $sourceImage,
            0,
            0,
            0,
            0,
            $desiredWidth,
            $desiredHeight,
            imagesx($sourceImage),
            imagesy($sourceImage)
        );

        return $thumbImg;
    }