protected function _getImageData( $code, &$mime )
	{
		$list = str_split( ltrim( $code, '#' ), 2 );

		if( count( $list ) !== 3 ) {
			throw new Exception( sprintf( 'Invalid color code "%1$s"', $code ) );
		}

		if( ( $img = imagecreate( 1, 1 ) ) === false ) {
			throw new Exception( 'Unable to create image' );
		}

		if( imagecolorallocate( $img, hexdec( $list[0] ), hexdec( $list[1] ), hexdec( $list[2] ) ) === false ) {
			throw new Exception( 'Unable to allocate color' );
		}

		try
		{
			ob_start();

			if( function_exists( 'imagegif' ) === true && imagegif( $img ) === true ) {
				$mime = 'image/gif';
			} else if( function_exists( 'imagepng' ) === true && imagepng( $img ) === true ) {
				$mime = 'image/png';
			} else {
				throw new Exception( 'Unable to create image. php-gd not installed?' );
			}

			$image = ob_get_contents();
			ob_end_clean();
		}
		catch( Exception $e )
		{
			ob_end_clean();
			throw $e;
		}

		if( imagedestroy( $img ) === false ) {
			throw new Exception( 'Unable to destroy image' );
		}

		return 'data:' . $mime . ';base64,' . base64_encode( $image );
	}