사이트 내 전체검색
PHP
php 이미지를 php 소스내에 포함시켜 출력하기.. (파일없이) 무료아이콘포함
최고관리자
https://cmd.kr/php/34 URL이 복사되었습니다.

본문

이미지를 소스로 저장한뒤
출력하는 방식 1개 파일로 기능,이미지를 다저장하여 출력하고자 할때 유용
(출처:actrun.com)


<?
$images = array(
"arrow_ltr"=>
"R0lGODlhJgAWAIABAP///wAAACH5BAHoAwEALAAAAAAmABYAAAIvjI+py+0PF4i0gVvzuVxXDnoQ".
"SIrUZGZoerKf28KjPNPOaku5RfZ+uQsKh8RiogAAOw==",
"back"=>
"R0lGODlhFAAUAKIAAAAAAP///93d3cDAwIaGhgQEBP///wAAACH5BAEAAAYALAAAAAAUABQAAAM8".
"aLrc/jDKSWWpjVysSNiYJ4CUOBJoqjniILzwuzLtYN/3zBSErf6kBW+gKRiPRghPh+EFK0mOUEqt".
"Wg0JADs=",
"buffer"=>
"R0lGODlhFAAUAKIAAAAAAP////j4+N3d3czMzLKysoaGhv///yH5BAEAAAcALAAAAAAUABQAAANo".
"eLrcribG90y4F1Amu5+NhY2kxl2CMKwrQRSGuVjp4LmwDAWqiAGFXChg+xhnRB+ptLOhai1crEmD".
"Dlwv4cEC46mi2YgJQKaxsEGDFnnGwWDTEzj9jrPRdbhuG8Cr/2INZIOEhXsbDwkAOw==",
"change"=>
......
중략
"ext_xml"=>
"R0lGODlhEAAQAEQAACH5BAEAABAALAAAAAAQABAAhP///wAAAPHx8YaGhjNmmabK8AAAmQAAgACA".
"gDOZADNm/zOZ/zP//8DAwDPM/wAA/wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA".
"AAAAAAAAAAAAAAAAAAVk4CCOpAid0ACsbNsMqNquAiA0AJzSdl8HwMBOUKghEApbESBUFQwABICx".
"OAAMxebThmA4EocatgnYKhaJhxUrIBNrh7jyt/PZa+0hYc/n02V4dzZufYV/PIGJboKBQkGPkEEQ".
"IQA7"
);


$img=$_GET[img];
if ($img) {
  header("Content-type: image/gif");
  header("Cache-control: public");
  header("Expires: ".date("r",mktime(0,0,0,1,1,2030)));
  header("Cache-control: max-age=".(60*60*24*7));
  header("Last-Modified: ".date("r",filemtime(__FILE__)));
  echo base64_decode($images[$img]);
}
else {
 foreach($images as $img=>$v) {
  echo "$img <img src='?img=$img'></a> ";
  //$fp=fopen("$img.gif","w");
  //$data=base64_decode($v);
  //fwrite($fp,$data);
  //fclose($fp);
  //echo "$img <img src='$img.gif'></a> ";
 }

}

?>

첨부파일

댓글목록

등록된 댓글이 없습니다.

PHP
871 (17/18P)

Search

Copyright © Cmd 명령어 3.140.196.5