오늘은 소설입니다.
sun's longitude:239 52 4.52 
· 자유게시판 · 묻고답하기 · 알파문서 · RPMS list
· 사용자문서 · 팁/FAQ모음 · 리눅스Links · 자료실
· 서버정보 · 운영자 · Books/FAQ · FreeBSD
/board/read.php:소스보기  
알파문서
자주 잊어먹거나, 메모해 둘 필요성이 있는 팁이나 문서, 기타 등등
[*** 쓰기 금지단어 패턴 ***]
글 본문 중간에 업로드할 이미지를 추가하는 방법 : @@이미지이름@@
ex) @@foo.gif@@
55 번 글: [PHP] base64 encoded images
글쓴이: 산이 [홈페이지] 글쓴날: 2003년 08월 12일 12:30:22 화(오후) 조회: 6238
## base64 encoded images
##
$images['null']     =
'R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==';
$images['_brown']   = 'R0lGODlhAQABAIAAAH8AAP///ywAAAAAAQABAAACAkQBADs=';
$images['_blue']    = 'R0lGODlhAQAJAJEAAAAAAP///wAA/zc/PywAAAAAAQAJAAACA5RvUwA7';
$images['_green']   = 'R0lGODlhAQAJAJEAAAAAAP///zc/PzF6CywAAAAAAQAJAAACA5xvUgA7';
$images['_margenta']= 'R0lGODlhAQAJAJEAAAAAAP///9MAizc/PywAAAAAAQAJAAACA5RvUwA7';
$images['_yellow']  = 'R0lGODlhAQAJAJEAAAAAAP///zc/P/v8nywAAAAAAQAJAAACA5xvUgA7';
$images['blue']     =
'R0lGODlhAQABAIAAAAAA/wAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
$images['darkblue'] =
'R0lGODlhAQABAIAAAEpYogAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
$images['pureblue'] =
'R0lGODlhAQABAIAAAD13swAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
$images['brown']    =
'R0lGODlhAQABAIAAAHsAAAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
$images['green']    =
'R0lGODlhAQABAIAAAAB9RQAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
$images['grey']     =
'R0lGODlhAQABAIAAAOjs6AAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
$images['lightgrey']=
'R0lGODlhAQABAIAAANHY0gAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
$images['darkgrey'] =
'R0lGODlhAQABAIAAAIycjwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
$images['margenta'] =
'R0lGODlhAQABAIAAANsAmgAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
$images['red']      =
'R0lGODlhAQABAIAAANxEHAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';
$images['yellow']   =
'R0lGODlhAQABAIAAAP/3AAAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==';


shell> which base64
alias base64='/usr/lib/python1.5/base64.py'
        /usr/lib/python1.5/base64.py
shell> base64 -e foo.gif > foo.gif.enc

<?php
function header_imcache($days=1)
{
  global $_SERVER; // for PHP/4.0.x

  $expire = (int)$days * 86400; // alway $days > 0

  $time['req'] = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']); // request time
  $time['cur'] = time(); // current time
  $time['chk'] = $time['cur'] - $expire; // filemtime() bad speed

  if($time['req'] > $time['chk']) // exclude '='
  {
    header('HTTP/1.1 304 Not Modified');
    exit; // don't print any messages
  }

  header('Expires: '.gmdate('D, d M Y H:i:s T',$time['cur']+$expire));
  header('Last-Modified: '.gmdate('D, d M Y H:i:s T')); // GMT of current
  header('Cache-control: private, max-age='.$expire.', pre-check='.$expire);

  return TRUE; // alway true
}

header_imcache();

$images = array();
$images['null']   = '....';
...
$images['yellow'] = '....';

$color = 'red'; // color name
header('Content-type: image/gif');
echo base64_decode($images[$color]);
exit; // don't print any messages
?>

 
이전글 : [PHP] ob_end_flush() 와 ob_end_clean()
다음글 : [PHP] urlencode(), base64_encode(), ...  
 from 61.254.75.40
JS(Redhands)Board 0.4 +@

|글쓰기| |답장쓰기| |수정| |삭제|
|이전글| |다음글| |목록보기|
인쇄용 

apache lighttpd linuxchannel.net 
Copyright 1997-2024. linuxchannel.net. All rights reserved.

Page loading: 0.01(server) + (network) + (browser) seconds