You are here

function sassy_compass__inline_image in Sassy 7.2

Same name and namespace in other branches
  1. 7.3 sassy_compass/functions/inline_image.inc \sassy_compass__inline_image()

File

extensions/compass/functions/inline_image.inc, line 3

Code

function sassy_compass__inline_image($file, $mime = NULL) {
  if ($path = sassy_compass__url($file, true, false)) {
    $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('');
}