Posted By

alyssonweb on 08/15/11


Tagged

image encode base64


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

guillermoj88gmailcom


Base64 Image Encode


 / Published in: PHP
 

URL: http://php.net/manual/en/function.base64-encode.php

used as so

.logo { background: url("<?php>") no-repeat right 5px; }

or

  1. function base64_encode_image ($filename=string,$filetype=string) {
  2. if ($filename) {
  3. $imgbinary = fread(fopen($filename, "r"), filesize($filename));
  4. return 'data:image/' . $filetype . ';base64,' . base64_encode($imgbinary);
  5. }
  6. }

Report this snippet  

You need to login to post a comment.