public function resolveDimensions(
        $newWidth,
        $newHeight,
        $type
    ) {
        $this->dstX = 0;
        $this->dstY = 0;
        $this->dstWidth = $newWidth;
        $this->dstHeight = $newHeight;
        $this->dstFrameX = $newWidth;
        $this->dstFrameY = $newHeight;

        $this->srcX = 0;
        $this->srcY = 0;
        $this->srcWidth = $this->originalWidth;
        $this->srcHeight = $this->originalHeight;

        if ($type == ElcodiMediaImageResizeTypes::NO_RESIZE) {
            $this->dstWidth = $this->originalWidth;
            $this->dstHeight = $this->originalHeight;
            $this->dstFrameX = $this->originalWidth;
            $this->dstFrameY = $this->originalHeight;
        } elseif (in_array($type, [
            ElcodiMediaImageResizeTypes::INSET,
            ElcodiMediaImageResizeTypes::INSET_FILL_WHITE,
            ElcodiMediaImageResizeTypes::OUTBOUNDS_FILL_WHITE,
            ElcodiMediaImageResizeTypes::OUTBOUND_CROP,
        ])) {
            $newAspectRatio = $newWidth / $newHeight;
            if ($newAspectRatio == $this->originalAspectRatio) {
                $height = $newHeight;
                $width = $newWidth;
            } elseif (
                ($newAspectRatio > $this->originalAspectRatio) ^
                (in_array($type, [
                    ElcodiMediaImageResizeTypes::OUTBOUNDS_FILL_WHITE,
                    ElcodiMediaImageResizeTypes::OUTBOUND_CROP,
                ])
                )
            ) {
                $height = $newHeight;
                $width = $newHeight * $this->originalAspectRatio;
            } else {
                $width = $newWidth;
                $height = $newWidth / $this->originalAspectRatio;
            }
            $changeRatio = $height / $this->originalHeight;

            if ($type == ElcodiMediaImageResizeTypes::OUTBOUND_CROP) {
                $this->srcX = (($width - $newWidth) / 2) / $changeRatio;
                $this->srcY = (($height - $newHeight) / 2) / $changeRatio;
                $this->srcWidth = $newWidth / $changeRatio;
                $this->srcHeight = $newHeight / $changeRatio;
            }

            if ($type == ElcodiMediaImageResizeTypes::INSET_FILL_WHITE) {
                $this->dstX = ($newWidth - $width) / 2;
                $this->dstY = ($newHeight - $height) / 2;
            }

            if (in_array($type, [
                ElcodiMediaImageResizeTypes::INSET,
                ElcodiMediaImageResizeTypes::INSET_FILL_WHITE,
                ElcodiMediaImageResizeTypes::OUTBOUNDS_FILL_WHITE,
            ])) {
                $this->dstWidth = $width;
                $this->dstHeight = $height;
            }

            if (in_array($type, [
                ElcodiMediaImageResizeTypes::INSET,
                ElcodiMediaImageResizeTypes::OUTBOUNDS_FILL_WHITE,
            ])) {
                $this->dstFrameX = $width;
                $this->dstFrameY = $height;
            }
        }

        return $this;
    }