PageRenderTime 46ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/spip/prive/images/wrapper.php

https://github.com/eyeswebcrea/espace-couture-sittler.fr
PHP | 28 lines | 21 code | 5 blank | 2 comment | 2 complexity | 5bf48006dafa0ca8a4d1e072d7a8cd78 MD5 | raw file
Possible License(s): LGPL-2.1, GPL-3.0
  1. <?php
  2. // wrapper image pour scintillement MSIE, cf.
  3. // http://www.ultra-fluide.com/ressources/css/css-hacks.htm#scintillement
  4. if (isset($_GET['file'])){
  5. $f = $_GET['file']; // pas de urldecode ici car on accepte de toute facon que les caracteres alphanumeriques
  6. if (preg_match(',^[a-z_0-9\-]+\.(gif|jpg|png)$,i', $f, $r)
  7. AND @file_exists('./'.$f)){
  8. $mime = array(
  9. 'jpg' => 'image/jpeg',
  10. 'gif' => 'image/gif',
  11. 'png' => 'image/png'
  12. );
  13. header('Content-Type: '.$mime[strtolower($r[1])]);
  14. header('Content-Length: '.filesize('./'.$f));
  15. header('Cache-Control: max-age=36000');
  16. header('Pragma: public');
  17. readfile('./'.$f);
  18. exit;
  19. }
  20. }
  21. header("Status : 404 Not Found");
  22. die('404 not found');
  23. ?>