[TYPO3-german] DynCss und relative Bildpfade ?
Ralf-Rene Schröder
ralf.rene at online.de
Fri Jun 21 17:23:31 CEST 2013
Am 21.06.2013 14:20, schrieb David Gurk:
> 1) Das entspricht dem Problem hier, oder?
> https://github.com/kaystrobach/TYPO3.dyncss_less/issues/1
genau, das ist das Problem...
aber auch die dort vorgeschlagene Modifikation des RegEx hat bei mir
keinerlei Auswirkung ???
(obwohl sie laut http://goo.gl/ffgHz eigentlich OK aussieht)
background: url("../relativerPfad/bild.jpg")
background: url('../relativerPfad/bild.jpg')
background: url(../relativerPfad/bild.jpg)
bleibt alles unverändert erhalten!!!
hier mal die entsprechende Funktion:
protected function _postCompile($string) {
$relativePath = dirname(substr($this->inputFilename,
strlen(PATH_site))) . '/';
// preg_match_all('|url\\([\'"]?([^\'"]*)["\']?\\);|Ui', $string, $matches);
preg_match_all('|url\([\'"]?([^\'"]*)["\']?\)|Ui', $string, $matches);
if(is_array($matches) && count($matches)) {
foreach($matches[1] as $key=>$value) {
if(is_file(dirname($this->inputFilename) . '/' . $value)) {
$newPath = '../../../../' . $relativePath . $value;
} elseif(is_file(PATH_site . $value)) {
$newPath = '../../../../' . $value;
} else {
// just do nothing to handle /, http(s), ...
$newPath = $value;
}
$matches[0][$key] = str_replace($matches[1][$key], $newPath,
$matches[0][$key]);
$string = str_replace($matches[1][$key], $newPath, $string);
}
}
return $string;
}
--
image[FORMAT] - Ralf-René Schröder
http://www.image-format.eu ... Wir geben Ihrem Image das richtige Format
More information about the TYPO3-german
mailing list