You are here

function sassy_compass__inline_image in Sassy 7.3

Same name and namespace in other branches
  1. 7.2 extensions/compass/functions/inline_image.inc \sassy_compass__inline_image()

File

sassy_compass/functions/inline_image.inc, line 3

Code

function sassy_compass__inline_image($file, $mime = NULL) {
  if ($path = sassy_compass__resolve_path($file)) {
    $info = getimagesize($path);
    $mime = $info['mime'];
    $data = base64_encode(file_get_contents($path));

    # todo - do not return encoded if file size > 32kb
    return new SassString("url('data:{$mime};base64,{$data}')");
  }
  return new SassString('');
}