Backend/PHP
이미지 웹에서 불러오기
Jeffrey Oh
2019. 11. 1. 15:17
이미지 웹에서 불러오기
$FilePath= (!empty($_GET['FilePath'])) ? $_GET['FilePath'] : ""; $noImage = ""; // noImage 경로 $ext = "jpg"; // 기본 확장자 $realfilepath = ""; if($BizFile != "") $realfilepath .= "/upload/".$FilePath; else $realfilepath .= "/upload/".$noImage; $fsize = filesize($realfilepath); if($FilePath!= "") $ext = substr($FilePath, strrpos($FilePath, ".")+1); header("Content-Type: image/".$ext) ; header("Content-Length: $fsize") ; $fd = fopen($realfilepath, "rb"); print fread ($fd, $fsize ) ; fclose ($fd) ; exit ; |
부르는 페이지에서는 아래와 같은 방법으로 진행
<img src="/aaa/bbb.php?FilePath=<?=$data['FilePath']?>&chkImg=.jpg" alt=""/> |