private function loadImageFromString($imagestring)
    {
        if (Utils::isJPGResource($imagestring)) {
            $this->extension = 'jpg';
            $this->type = IMAGETYPE_JPEG;
        }

        if (Utils::isPNGResource($imagestring)) {
            $this->extension = 'png';
            $this->type = IMAGETYPE_PNG;
        }

        $this->from = 'imagestring';
        $this->resource = imagecreatefromstring($imagestring);
        $this->width = $this->boxWidth = imagesx($this->resource);
        $this->height = $this->boxHeight = imagesy($this->resource);
    }