图片网址:data:image / png; base64(KineticJS)

时间:2013-01-06 21:23:59

标签: jquery image html5 canvas kineticjs

将KineticJS用于generate an image of the canvas时,函数stage.toDataURL()为我提供了一个以data:image/png;base64开头,后跟一个非常长的字符串的网址!

问题:网址如何运作?它不包含Web服务器地址,它是否实际从任何地方检索图像?

我想将此生成的图像保存到我的网络服务器,最好将这个非常长的字符串发送到我的服务器POST,并让服务器curl这个网址?< / p>

网址

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAkIAAADICAYAAAAEE46XAAALwElEQVR4Xu3ZUW7dVgwE0GRD3f86uqEWBVLARlUIxBXEeZmTb8uPPEMbE/nnD/8IECBAgAABAqUCP0v3tjYBAgQIECBA4Ici5AgIECBAgACBWgFFqDZ6ixMgQIAAAQKKkBsgQIAAAQIEagUUodroLU6AAAECBAgoQm6AAAECBAgQqBVQhGqjtzgBAgQIECCgCLkBAgQIECBAoFZAEaqN3uIECBAgQICAIuQGCBAgQIAAgVoBRag2eosTIECAAAECipAbIECAAAECBGoFFKHa6C1OgAABAgQIKEJugAABAgQIEKgVUIRqo7c4AQIECBAgoAi5AQIECBAgQKBWQBGqjd7iBAgQIECAgCLkBggQIECAAIFaAUWoNnqLEyBAgAABAoqQGyBAgAABAgRqBRSh2ugtToAAAQIECChCboAAAQIECBCoFVCEaqO3OAECBAgQIKAIuQECBAgQIECgVkARqo3e4gQIECBAgIAi5AYIECBAgACBWgFFqDZ6ixMgQIAAAQKKkBsgQIAAAQIEagUUodroLU6AAAECBAgoQm6AAAECBAgQqBVQhGqjtzgBAgQIECCgCLkBAgQIECBAoFZAEaqN3uIECBAgQICAIuQGCBAgQIAAgVoBRag2eosTIECAAAECipAbIECAAAECBGoFFKHa6C1OgAABAgQIKEJugAABAgQIEKgVUIRqo7c4AQIECBAgoAi5AQIECBAgQKBWQBGqjd7iBAgQIECAgCLkBggQIECAAIFaAUWoNnqLEyBAgAABAoqQGyBAgAABAgRqBRSh2ugtToAAAQIECChCboAAAQIECBCoFVC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ECAAAECipAbIECAAAECBGoFFKHa6C1OgAABAgQIKEJugAABAgQIEKgVUIRqo7c4AQIECBAgoAi5AQIECBAgQKBWQBGqjd7iBAgQIECAgCLkBggQIECAAIFaAUWoNnqLEyBAgAABAoqQGyBAgAABAgRqBRSh2ugtToAAAQIECChCboAAAQIECBCoFVCEaqO3OAECBAgQIKAIuQECBAgQIECgVkARqo3e4gQIECBAgIAi5AYIECBAgACBWgFFqDZ6ixMgQIAAAQKKkBsgQIAAAQIEagUUodroLU6AAAECBAgoQm6AAAECBAgQqBVQhGqjtzgBAgQIECCgCLkBAgQIECBAoFZAEaqN3uIECBAgQICAIuQGCBAgQIAAgVoBRag2eosTIECAAAECipAbIECAAAECBGoFFKHa6C1OgAABAgQIKEJugAABAgQIEKgVUIRqo7c4AQIECBAgoAi5AQIECBAgQKBWQBGqjd7iBAgQIECAgCLkBggQIECAAIFaAUWoNnqLEyBAgAABAoqQGyBAgAABAgRqBRSh2ugtToAAAQIECChCboAAAQIECBCoFVCEaqO3OAECBAgQIKAIuQECBAgQIECgVkARqo3e4gQIECBAgIAi5AYIECBAgACBWgFFqDZ6ixMgQIAAAQKKkBsgQIAAAQIEagUUodroLU6AAAECBAgoQm6AAAECBAgQqBVQhGqjtzgBAgQIECCgCLkBAgQIECBAoFZAEaqN3uIECBAgQICAIuQGCBAgQIAAgVoBRag2eosTIECAAAECipAbIECAAAECBGoFFKHa6C1OgAABAgQIKEJugAABAgQIEKgVUIRqo7c4AQIECBAgoAi5AQIECBAgQKBWQBGqjd7iBAgQIECAgCLkBggQIECAAIFaAUWoNnqLEyBAgAABAoqQGyBAgAABAgRqBRSh2ugtToAAAQIECChCboAAAQIECBCoFVCEaqO3OAECBAgQIKAIuQECBAgQIECgVkARqo3e4gQIECBAgMDfiLaSyZOoJNUAAAAASUVORK5CYII=

1 个答案:

答案 0 :(得分:4)

我认为这是“数据URI方案”中的URL。

http://en.wikipedia.org/wiki/Data_URI_scheme

他们的红点示例很好:

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot">

如果你发布数据,base64解码它,并将其保存为.png,它将是一个有效的png图像。