From 1e69be0b7a47c84b09a52266115ec7fd53d9376e Mon Sep 17 00:00:00 2001 From: mistic100 Date: Fri, 6 Dec 2013 17:18:19 +0000 Subject: [PATCH] FileCombiner does not try to change url of images embedded in base64 git-svn-id: http://piwigo.org/svn/trunk@25800 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/template.class.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/template.class.php b/include/template.class.php index 56ef8cb60..733d051ff 100644 --- a/include/template.class.php +++ b/include/template.class.php @@ -1537,14 +1537,15 @@ final class FileCombiner private static function process_css_rec($css, $dir) { - static $PATTERN = "#url\(\s*['|\"]{0,1}(.*?)['|\"]{0,1}\s*\)#"; + static $PATTERN_URL = "#url\(\s*['|\"]{0,1}(.*?)['|\"]{0,1}\s*\)#"; + static $PATTERN_IMPORT = "#@import\s*['|\"]{0,1}(.*?)['|\"]{0,1};#"; - if (preg_match_all($PATTERN, $css, $matches, PREG_SET_ORDER)) + if (preg_match_all($PATTERN_URL, $css, $matches, PREG_SET_ORDER)) { $search = $replace = array(); foreach ($matches as $match) { - if ( !url_is_remote($match[1]) && $match[1][0] != '/') + if ( !url_is_remote($match[1]) && $match[1][0] != '/' && strpos($match[1], 'data:image/')===false) { $relative = $dir . "/$match[1]"; $search[] = $match[0]; @@ -1554,8 +1555,7 @@ final class FileCombiner $css = str_replace($search, $replace, $css); } - $imports = preg_match_all("#@import\s*['|\"]{0,1}(.*?)['|\"]{0,1};#", $css, $matches, PREG_SET_ORDER); - if ($imports) + if (preg_match_all($PATTERN_IMPORT, $css, $matches, PREG_SET_ORDER)) { $search = $replace = array(); foreach ($matches as $match)