You are here

function _css_emimage_build_inline in CSS Embedded Images 7

Same name and namespace in other branches
  1. 6.2 css_emimage.module \_css_emimage_build_inline()

Generates CSS with data URIs inline with the declarations.

Return value

string CSS with inline data URIs

2 calls to _css_emimage_build_inline()
_css_emimage_process in ./css_emimage.module
Helper function to replace URLs with data URIs.
_css_emimage_text_processor in ./css_emimage.advagg.inc
Process the css text and replace it with image data where necessary.

File

./css_emimage.inc, line 26
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;
}