image.php 468 B

12345678910111213141516171819
  1. <?php
  2. set_include_path(dirname(__FILE__) . PATH_SEPARATOR .
  3. dirname(dirname(__FILE__)) . PATH_SEPARATOR .
  4. dirname(dirname(__FILE__)) . "/include" . PATH_SEPARATOR .
  5. get_include_path());
  6. require_once "config.php";
  7. chdir('..');
  8. $filename = CACHE_DIR . '/images/' . sha1($_GET['url']) . '.png';
  9. if (file_exists($filename)) {
  10. header("Content-type: image/png");
  11. echo file_get_contents($filename);
  12. } else {
  13. header("Location: " . $_GET['url']);
  14. }
  15. ?>