private function resize($width, $height, $x1 = 0, $y1 = 0, $dstX = 0, $dstY = 0, $isCrop = false)
    {
        if ($this->resource && $width > 0 && $height > 0) {
            $image = imagecreatetruecolor($width, $height);

            if ($this->isPNG()) {
                imagealphablending($image, false);
                imagesavealpha($image, true);
            }

            imagecopyresampled(
                $image,
                $this->resource,
                $dstX,
                $dstY,
                $x1,
                $y1,
                $width,
                $height,
                $isCrop ? $width : $this->width,
                $isCrop ? $height : $this->height
            );

            $this->resource = $image;
            $this->width = $this->boxWidth = imagesx($this->resource);
            $this->height = $this->boxHeight = imagesy($this->resource);
        }

        return $this;
    }