PHP 에서 이미지 url 주소 숨기기
페이지 정보
본문
php 에서 이미지의 경로를 숨기고 싶거나, 원격의 이미지를 가져와서 처리하고자 할 때..
기본적인 구문은 아래와 같다.
<?php
$img_url = "http://i.imgur.com/YB1uXcy.jpg";
header('Content-Type: image/jpg');
readfile($img_url);
?>
서버 로컬 경로에 있는 파일은 아래와 같이 할 수 있다.
<?php
Header('Content-Type: image/gif');
$fpath = 'image/'.$img.'.gif';
if( file_exists( $fpath ) )
readfile( $fpath );
else
readfile( 'image/empty.gif' );
?>
http://www.phpschool.com/gnuboard4/bbs/board.php?bo_table=qna_function&wr_id=101177
기본적인 구문은 아래와 같다.
<?php
$img_url = "http://i.imgur.com/YB1uXcy.jpg";
header('Content-Type: image/jpg');
readfile($img_url);
?>
서버 로컬 경로에 있는 파일은 아래와 같이 할 수 있다.
<?php
Header('Content-Type: image/gif');
$fpath = 'image/'.$img.'.gif';
if( file_exists( $fpath ) )
readfile( $fpath );
else
readfile( 'image/empty.gif' );
?>
http://www.phpschool.com/gnuboard4/bbs/board.php?bo_table=qna_function&wr_id=101177
추천0
댓글목록
등록된 댓글이 없습니다.