Compactar arquivo estático css com GZIP

então eu tenho um arquivo css, style.css. no mesmo diretório eu tenho a pasta images /. Como posso criar um script que comprima style.css, mas de outra pasta?

Agora eu tenho isso:

<?php
  if(isset($_GET['css'])) $file = array('url' => htmlspecialchars($_GET['css']), 'type' => 'text/css');
  if(isset($_GET['js'])) $file = array('url' => htmlspecialchars($_GET['js']), 'type' => 'application/javascript');
  if(!isset($file)) exit();

  header('Content-type: '.$file['type']);
  header('Cache-Control: max-age='.(60*60*6).', must-revalidate');  

  // whitespace+comment removal, in case gzip is off
  function compress($buffer){
    global $file;
    $buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer);
    $buffer = str_replace(array("\r\n", "\r", "\n", "\t", '  ', '    ', '    '), ' ', $buffer);
    return $buffer;
  }

  if(extension_loaded('zlib'))
    if(substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')) ob_start("ob_gzhandler");

  else ob_start("compress");

  include($file['url']);    
  ob_end_flush();
?>

e use algo assim:

<style type="text/css">
 @import "http://mysite.com/lib/c.php?css=../style.css";
</style>

está tudo bem, exceto que o caminho para as imagens dentro do arquivo css não funciona mais. eu acho que é porque (images / bg.jpg) se torna (../images/bg.jpg)

posso corrigir isso sem precisar mover meu script c.php no mesmo diretório da folha de estilo?

questionAnswers(1)

yourAnswerToTheQuestion