/**
  * Method to translate images into data URIs
  *
  * @param string $text
  *
  * @return string
  */
 private function parseImages($text = null)
 {
     if ($this->params->get('data_uris', 0) != 1) {
         return $text;
     }
     if (preg_match_all('/src=([\'\\"]{1})([^\'\\"]+)([\'\\"]{1})/i', $text, $matches)) {
         foreach ($matches[2] as $index => $match) {
             $match = preg_replace('/([\'\\"\\ ]+)/', '', $match);
             $path = ScriptMergeHelper::getFilePath($match);
             $content = ScriptMergeHelper::getImageUrl($path);
             if (!empty($content)) {
                 $text = str_replace($matches[0][$index], 'src=' . $content, $text);
             }
         }
     }
     if (preg_match_all('/url\\(([a-zA-Z0-9\\.\\-\\_\\/\\ \' \\"]+)\\)/i', $text, $matches)) {
         foreach ($matches[1] as $index => $match) {
             $match = preg_replace('/([\'\\"\\ ]+)/', '', $match);
             $path = ScriptMergeHelper::getFilePath($match);
             $content = ScriptMergeHelper::getImageUrl($path);
             if (!empty($content)) {
                 $text = str_replace($matches[0][$index], 'url(' . $content . ')', $text);
             }
         }
     }
     if (preg_match_all('/url\\(([a-zA-Z0-9\\.\\-\\_\\/\\ \' \\"]+)\\)/i', $text, $matches)) {
         foreach ($matches[1] as $index => $match) {
             $match = preg_replace('/([\'\\"\\ ]+)/', '', $match);
             $path = ScriptMergeHelper::getFilePath($match);
             $content = ScriptMergeHelper::getImageUrl($path);
             if (!empty($content)) {
                 $text = str_replace($matches[0][$index], 'url(' . $content . ')', $text);
             }
         }
     }
     return $text;
 }