Base64 Image Encode


/ Published in: PHP
Save to your folder(s)

used as so


.logo {
background: url("


Copy this code and paste it in your HTML
  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. }

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.