If I'm not completely wrong, this assumes, that all CSS image URLs are relative to the base URL. That may not be always the case. I think, you will need the full CSS file path here, take the `dirname()` and append the image URL. Therefore I'd probably use a closure for the callback. Then you can pass the `$fileName` along with the `use` keyword:

```php
public function addCssImageFingerPrint($fileName)
{
    $fileContents = file_get_contents($f);
    $fileContents = preg_replace_callback('/url\([\'\"]?(\/.*?)\.(jpg|jpeg|gif|png)[\'\"]?\)/', function($matches) use $fileName {
        // ... 
    }, $fileContents);
}
```

And while maybe unlikely, there could still also be absolute URLs in the CSS. We need to filter them out.