You are here

function _css_emimage_build_inline in CSS Embedded Images 6.2

Same name and namespace in other branches
  1. 7 css_emimage.inc \_css_emimage_build_inline()

Generates CSS with data URIs inline with the declarations.

Return value

string CSS with inline data URIs

1 call to _css_emimage_build_inline()
_css_emimage_text_processor in ./css_emimage.module
Process the css text and replace it with image data where necessary.

File

./css_emimage.module, line 642
CSS Embedded Images module.

Code

function _css_emimage_build_inline($css, $declarations) {
  foreach ($declarations as $data) {
    if ($data['base64']) {
      $css = str_replace($data['token'], 'url(data:' . $data['mime_type'] . ';base64,' . $data['base64'] . ')', $css);
    }
    else {
      $css = str_replace($data['token'], $data['url'], $css);
    }
  }
  return $css;
}