public function embed($keep_resource = false) {
		ob_start();

		switch ($this->_output_format) {
			case 'jpeg' :
			case 'jpg'  :
				imagejpeg($this->_image_resource);
				break;
			case 'png':
				imagepng($this->_image_resource);
				break;
			case 'gif':
				imagegif($this->_image_resource);
				break;
		}

		$str = ob_get_contents();

		ob_end_clean();

		if (!$keep_resource) {
			imagedestroy($this->_image_resource);
		}

		return 'data:image/' . $this->_output_format . ';base64,' . base64_encode($str);
	}