Home > Article > Backend Development > How do I Encode an Image in Base64 for Firefox/IE Add-ons?
Base64 Encoding an Image for Firefox/IE Add-on
When creating an open search add-on for Firefox or Internet Explorer, the image needs to be Base64 encoded. This article provides methods to encode an image using Base64.
Using an Online Tool
Using PHP
If you are familiar with PHP, you can perform Base64 encoding using the following steps:
<code class="php"><?php $im = file_get_contents('filename.gif'); $imdata = base64_encode($im); ?> </code>
Examples of Icon Element Usage
In OpenSearch plugins, the icon element is used to specify the image. Here is an example:
<img width="16" height="16" src="data:image/x-icon;base64,imageData">
Replace "imageData" with your Base64 encoded data.
Additional Resources
The above is the detailed content of How do I Encode an Image in Base64 for Firefox/IE Add-ons?. For more information, please follow other related articles on the PHP Chinese website!