외부 이미지 다운로드 가져오는 함수
function getdown_img($urlimage, $wr_id){
$save_image_file = "/home/xxxx/public_html/upload/xxxxx/".$wr_id; //저장할 디렉토리
$save_image_file2 = "../upload/xxxx/".$wr_id; //저장할 디렉토리
$url= "https://xxxxxx.com/"; // 가져올 외부 이미지
$imagename_url_tmp1 = explode('" alt=',$urlimage);
$imagename_url_tmp2 = explode('<img src="',$imagename_url_tmp1[0]);
$imagename_url = $imagename_url_tmp2[1];
$tmptime = date('YmdHis').(microtime(true) * 10000); //시간
$imagename_tmp = basename($urlimage);
$imagename_tmp2 = explode('" alt=',$imagename_tmp);
$imagename_tmp3 = explode('<img src="',$imagename_tmp2[0]);
//$imagename = $imagename_tmp2[0];
$imagename = $imagename_url;
if(preg_match("/\.(gif|jpg|jpeg|png)$/i", $imagename)) { //이지지 확장자 체크
$tmptime = date('YmdHis').(microtime(true) * 10000); //시간
$save_file_name = $wr_id."-".$i."-".$tmptime;
@mkdir($save_image_file, '757'); // 디렉토리 만들기
@chmod($save_image_file, '757'); // 퍼미션 설정
$filepath[0] = $save_image_file."/".$save_file_name.".jpg";
copy($imagename, $filepath[0]); ///이미지 url이 정확해야한다.
$filepath[1] = $save_image_file2."/".$save_file_name.".jpg";
$filepath = $filepath[1];
} else {
//echo 'error .';
}
return $filepath;
}
외부 이미지를 사용할 서버로 가져오는 함수입니다.
$save_image_file2 = "../upload/xxxx/".$wr_id; //저장할 디렉토리
위와같이 디렉토리 생성하고 /wr_id값을 붙여서 해당디렉토리에 이미지를 저장하게 됩니다.
게시판 목록
그누보드5 팁자료실
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 공지 | 3년 전 | 4402 | ||
| 24 | 12년 전 | 7368 | ||
| 23 | 12년 전 | 5223 | ||
| 22 |
JMoon
|
12년 전 | 6243 | |
| 21 |
오늘도망했다
|
12년 전 | 13478 | |
| 20 | 12년 전 | 4320 | ||
| 19 | 12년 전 | 8044 | ||
| 18 | 12년 전 | 6510 | ||
| 17 | 12년 전 | 5414 | ||
| 16 | 12년 전 | 6132 | ||
| 15 | 12년 전 | 5612 | ||
| 14 | 12년 전 | 9229 | ||
| 13 | 12년 전 | 8199 | ||
| 12 | 12년 전 | 4949 | ||
| 11 | 12년 전 | 7265 | ||
| 10 |
|
12년 전 | 8958 | |
| 9 | 12년 전 | 7552 | ||
| 8 | 12년 전 | 8128 | ||
| 7 | 12년 전 | 7327 | ||
| 6 | 12년 전 | 7457 | ||
| 5 | 12년 전 | 7374 | ||
| 4 | 12년 전 | 7462 | ||
| 3 | 12년 전 | 6956 | ||
| 2 | 12년 전 | 5801 | ||
| 1 | 12년 전 | 12121 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기