시간이 많이 없어서 영카트는 아직 확인하지 못했군요..
http://sir.co.kr/bbs/board.php?bo_table=g5_tip&wr_id=2297
에서 image_proc.function.php 소스 복사하시면 됩니다.
이건 첨부파일 용이라 에디터는 적용안됩니다!!
[code]
//워터마크 체크할 파일 인클루드
include_once(G5_LIB_PATH.'/image_proc.function.php');
$sql_data = "select * from g5_board_file where bo_table = '$bo_table' and wr_id = '$wr_id' ";
$res_data = mysql_query($sql_data);
while ($row_data = mysql_fetch_array($res_data)) {
$exp = $row_data[bf_file];//원본파일
$exp_img = explode(".",$exp);
//확장자가 이미지 일때만
if ($exp_img[1] == "jpg" or $exp_img[1] == "png" or $exp_img[1] == "gif" or $exp_img[1] == "jpeg" or $exp_img[1] == "JPG" or $exp_img[1] == "PNG" or $exp_img[1] == "GIF" or $exp_img[1] == "JPEG") {
$path_file = G5_PATH.'/data/file/'.$bo_table."/".$row_data[bf_file];
$path_mark_file = G5_PATH.'/img/wtm.gif';//워터마크에 사용할 파일
$path_save_top_right_file = G5_PATH.'/data/file/'.$bo_table."/".$row_data[bf_file]; //워터마크 처리한 것을 원본에 덮어씌움
//원본의 이미지 리소스를 받아온다.
list($src, $src_w, $src_h) = get_image_resource_from_file ($path_file);
if (empty($src)) die($GLOBALS['errormsg'] . "<br />\n");
//워터마크에 사용될 이미지 리소스를 받아온다.
list($mark, $mark_w, $mark_h) = get_image_resource_from_file ($path_mark_file);
if (empty($mark)) die($GLOBALS['errormsg'] . "<br />\n");
//원본을 5 분의 1로 축소한 너비와 높이를 구한다.
$src_w_small = $src_w; //리사이징 제거함
$src_h_small = get_size_by_rule($src_w, $src_h, $src_w_small);
//원본의 상단 오른쪽을 기준으로 선명도 100으로 워터마크 처리
if ($src_w > 200) { //width가 200 이하인 이미지는 워터마크 처리안함
$src2 = get_image_resize($src, $src_w, $src_h, $src_w_small, $src_h_small);
if (empty($src2)) die($GLOBALS['errormsg'] . "<br />\n");
$src2_x = $src_w_small - $mark_w;
$src2_y = 0;
//padding 을 10px 씩 줘야 하므로 x좌표는 왼쪽으로 10 이동 y좌표는 아래로 10 이동
$src2_x -= 10;
$src2_y += 10;
//워터마크는 투명도 50으로 설정
$result_watermark = imagecopymerge($src2, $mark, $src2_x, $src2_y, 0, 0, $mark_w, $mark_h, 50);
if ($result_watermark === false) die("워터마크 처리에 실패하였습니다.<br />\n");
$result_save = save_image_from_resource ($src2, $path_save_top_right_file, 100, 2);//저장
if ($result_save === false) die($GLOBALS['errormsg'] . "<br />\n");
@imagedestroy($src2);
}
} // if
}
[/code]
http://sir.co.kr/bbs/board.php?bo_table=g5_tip&wr_id=2297
에서 image_proc.function.php 소스 복사하시면 됩니다.
이건 첨부파일 용이라 에디터는 적용안됩니다!!
[code]
//워터마크 체크할 파일 인클루드
include_once(G5_LIB_PATH.'/image_proc.function.php');
$sql_data = "select * from g5_board_file where bo_table = '$bo_table' and wr_id = '$wr_id' ";
$res_data = mysql_query($sql_data);
while ($row_data = mysql_fetch_array($res_data)) {
$exp = $row_data[bf_file];//원본파일
$exp_img = explode(".",$exp);
//확장자가 이미지 일때만
if ($exp_img[1] == "jpg" or $exp_img[1] == "png" or $exp_img[1] == "gif" or $exp_img[1] == "jpeg" or $exp_img[1] == "JPG" or $exp_img[1] == "PNG" or $exp_img[1] == "GIF" or $exp_img[1] == "JPEG") {
$path_file = G5_PATH.'/data/file/'.$bo_table."/".$row_data[bf_file];
$path_mark_file = G5_PATH.'/img/wtm.gif';//워터마크에 사용할 파일
$path_save_top_right_file = G5_PATH.'/data/file/'.$bo_table."/".$row_data[bf_file]; //워터마크 처리한 것을 원본에 덮어씌움
//원본의 이미지 리소스를 받아온다.
list($src, $src_w, $src_h) = get_image_resource_from_file ($path_file);
if (empty($src)) die($GLOBALS['errormsg'] . "<br />\n");
//워터마크에 사용될 이미지 리소스를 받아온다.
list($mark, $mark_w, $mark_h) = get_image_resource_from_file ($path_mark_file);
if (empty($mark)) die($GLOBALS['errormsg'] . "<br />\n");
//원본을 5 분의 1로 축소한 너비와 높이를 구한다.
$src_w_small = $src_w; //리사이징 제거함
$src_h_small = get_size_by_rule($src_w, $src_h, $src_w_small);
//원본의 상단 오른쪽을 기준으로 선명도 100으로 워터마크 처리
if ($src_w > 200) { //width가 200 이하인 이미지는 워터마크 처리안함
$src2 = get_image_resize($src, $src_w, $src_h, $src_w_small, $src_h_small);
if (empty($src2)) die($GLOBALS['errormsg'] . "<br />\n");
$src2_x = $src_w_small - $mark_w;
$src2_y = 0;
//padding 을 10px 씩 줘야 하므로 x좌표는 왼쪽으로 10 이동 y좌표는 아래로 10 이동
$src2_x -= 10;
$src2_y += 10;
//워터마크는 투명도 50으로 설정
$result_watermark = imagecopymerge($src2, $mark, $src2_x, $src2_y, 0, 0, $mark_w, $mark_h, 50);
if ($result_watermark === false) die("워터마크 처리에 실패하였습니다.<br />\n");
$result_save = save_image_from_resource ($src2, $path_save_top_right_file, 100, 2);//저장
if ($result_save === false) die($GLOBALS['errormsg'] . "<br />\n");
@imagedestroy($src2);
}
} // if
}
[/code]
댓글 9개
게시글 목록
| 번호 | 제목 |
|---|---|
| 2410 | |
| 2401 | |
| 2395 | |
| 2387 | |
| 2385 | |
| 2377 | |
| 2374 | |
| 2372 | |
| 2368 | |
| 2367 | |
| 2366 | |
| 2364 | |
| 2354 | |
| 2353 | |
| 2352 | |
| 2349 | |
| 2333 | |
| 2329 | |
| 2327 | |
| 2304 | |
| 2298 | |
| 2297 | |
| 2295 | |
| 2288 | |
| 2282 | |
| 2279 | |
| 2278 | |
| 2276 | |
| 2273 | |
| 2268 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기