如何生成数据URI [英] How to Generate a Data URI

查看:141
本文介绍了如何生成数据URI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近遇到了数据URI方案,并且正在维基百科上阅读。

I recently came across Data URI scheme and was reading about it on Wikipedia.

示例代码如下所示:

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUA
          AAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO
          9TXL0Y4OHwAAAABJRU5ErkJggg==" alt="Red dot">

我的问题是:你如何生成代码(IE: iVBORw0KGgoAAAA ... )在网站上使用?

My question is this: How do you generate the code (IE: iVBORw0KGgoAAAA...) for using on a website?

注意:我特意在寻找没有服务器端脚本的方法。但您仍然可以为可能遇到此问题的其他人发布服务器端脚本方式。我也见过网站会为你做这个,我怎么能自己做?

Note: I am specifically looking for how this is done with no server side scripts. But you can still post server side script ways for others who may come across this question. Also I have seen websites that will do this for you, how can I do it myself?

推荐答案

在做了一些阅读之后,我遇到了一个网站已链接到我信任的网站。效果很好,并为我提供了插入HTML,CSS和原始数据的代码。我找到了非常好的和最好的方式。请注意,我为数据URI生成而访问的某些网站因Google或AVG的恶意软件而被阻止。这个一个似乎没问题。

After doing some more reading I came across a website that was linked to from a site I trust. Works well and gives me the code for inserting into HTML, CSS, and the raw data. Very nice and best way I have found. Beware though that some of the sites I went to for Data URI generation were blocked due to malware by Google or AVG. This one seems okay though.

这篇关于如何生成数据URI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆