Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [php]serwowanie grafiki z innegro serwera
sanchoo
post
Post #1





Grupa: Zarejestrowani
Postów: 161
Pomógł: 1
Dołączył: 11.02.2007
Skąd: Kraków

Ostrzeżenie: (0%)
-----


Witam! mam serwowac banery z inengo serwera: jelsi sa serwowane to dziala bez problemu zrobilem to tak:

HTML:
  1. <img src="http://XXXXXX/banery/baner_show.php?h=1&id_bl=102&id_bb=44" border="0" alt="n


php:
  1. <?php
  2. $path = 'baners/' . $baner['path_banner']; //$baner['path_baner'] - nazwa pliku 
  3.  
  4.  echo $banery->_showimage($path, $baner['mimetype']);
  5. exit();
  6. ?>


_showimage:
  1. <?php
  2. function &_showImage(&$path, &$type)
  3. {
  4.  
  5. $source = $this->_getSourceFile( $path );
  6. header("Content-type: " . $type);
  7. header("Content-Length: " . strlen($source));
  8. header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
  9. header("Last-Modified: " . gmDate("D, d M Y H:i:s") . " GMT");
  10. header("Cache-Control: no store, no-cache, must-revalidate");
  11. header("Cache-Control: post-check=0, pre-check=0", false);
  12. header("Pragma: no-cache");
  13. header("Connection: close");
  14. return $source;
  15.  
  16. }
  17. function &_getSourceFile($path)
  18. {
  19. if (!$fp = fopen($path, 'rb'))
  20. {
  21. return false;
  22. }
  23. else
  24. {
  25. $sourceFile = fread($fp, filesize($path));
  26. fclose($fp);
  27. return $sourceFile;
  28. }
  29.  
  30. }
  31. ?>



wszystko dzila ladnie ... jesli nie zmienie $path = 'baners/' np na $path = 'http:// JAKIS INNY SERWER
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 22:50