Base64编码图像 [英] Base64 Encoding Image
问题描述
我只熟悉PHP
据我所知,图像数据有一个xml元素。您可以使用此网站对文件进行编码(使用上传字段) 。然后只需将数据复制并粘贴到XML元素。
您也可以使用PHP这样做:
<?php
$ im = file_get_contents('filename.gif');
$ imdata = base64_encode($ im);
?>
使用 Mozilla的指南,以获得有关创建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编码图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!