本文介绍了Base64编码图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为Firefox / IE构建一个开放的搜索插件,并且图像需要是Base64 Encoded,所以我可以如何基于64个编码的图标?我只熟悉PHP
解决方案
据我所知,图像数据有一个xml元素。您可以使用此对文件进行编码(使用上传字段) 。然后只需将数据复制并粘贴到XML元素。
您也可以使用PHP这样做:
<?php
$ im = file_get_contents('filename.gif');
$ imdata = base64_encode($ im);
?>
使用,以获得有关创建OpenSearch插件的帮助。例如,图标元素是这样使用的:
< img width =16height =16>数据:图像/ X-图标;的base64,为imageData< />
其中 imageData
是您的base64数据。 / p>
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?
I am only familiar with PHP
解决方案
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.
You could also use PHP to do this like so:
<?php
$im = file_get_contents('filename.gif');
$imdata = base64_encode($im);
?>
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</>
Where imageData
is your base64 data.
这篇关于Base64编码图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!