public function resize($width, $height, $preserveAspectRatio = true)
    {
        if ($preserveAspectRatio) {
            $currentSize = $this->getSize();

            $currentAspectRatio = round($currentSize->width / $currentSize->height, 3);
            $aspectRatio = round($width / $height, 3);

            if ($currentAspectRatio <> $aspectRatio) {
                if ($width < $height) {
                    $height = round($width / $currentAspectRatio);
                } else {
                    $width = round($height * $currentAspectRatio);
                }
            }
        }

        $size = new Box($width, $height);

        $this->image->resize($size);

        return $this;
    }