Base64编码图像 [英] Base64 Encoding Image

查看:185
本文介绍了Base64编码图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立一个开放的搜索插件在Firefox / IE浏览器和图像需要为Base64恩codeD,所以我怎么能基地64 EN code中的图标我有吗?

I am building an open search add-on for Firefox/IE and the image needs to be Base64 Encoded so how can I base 64 encode the favicon I have?

我只熟悉PHP

推荐答案

据我记得有用于图像数据的XML元素。您可以使用此网站为en codeA文件(使用上传字段)。然后,只需将数据复制并粘贴到XML元素。

As far as I remember there is an xml element for the image data. You can use this website to encode a file (use the upload field). Then just copy and paste the data to the XML element.

您也可以使用PHP来做到这一点,像这样:

You could also use PHP to do this like so:

 <?php
        $im = file_get_contents('filename.gif');
        $imdata = base64_encode($im);      
?> 

使用 Mozilla的有关创建OpenSearch的插件帮助指南。例如,图标元素用于这样的:

Use Mozilla's guide for help on creating OpenSearch plugins. For example, the icon element is used like this:

<img width="16" height="16">data:image/x-icon;base64,imageData</>

其中,为imageData 是您的base64数据。

Where imageData is your base64 data.

这篇关于Base64编码图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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