I need to understand your website, but you definitely must have some symlinks. The point of if(!config::$storage_is_within_doc_root) return;
is to make sure the CSS is within the server's document root, because that's the only way a CSS file can be loaded by URL. However, in case you have some symlink setup, the CSS might be outside the server document root, possibly still accessible by symlink.
Just by example, if server document root is /Users/username/www/public_html
, essentially the CSS would need to be somewhere inside that dir. If not, it's not accessible by URL, unless perhaps you are using some symlinks. Files gallery converts symlinks to "real" paths internally, because this is how it gets data about files and knows the real location.
Looking at your code, it seems you have reset config::$storage_path
storage path from it's REAL full path, to a relative path that contains a symlink. That's why it likely works in browser, even if the real path is not inside document root. And the same for $src
which you have assigned to a relative path, instead of the real path. I might have to re-think this process, but it's a bit clumsy to depends on relative paths instead of full real server paths.