<?php
//이미지 처리 함수 인클루드
include_once 'lib/image_proc.function.php';
$path_file = 'sample_image/test.jpg';//원본파일
$path_mark_file ='sample_image/php.png';//워터마크에 사용할 파일
$path_save_file = 'sample_image/watermak.jpg';//워터마크 처리한 것을 저장할 파일
//원본의 이미지 리소스를 받아온다.
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");
//원본의 왼쪽 꼭지점을 기준점으로 선명도 60으로 워터마크 처리
$result_watermark = imagecopymerge($src, $mark, 0, 0, 0, 0, $mark_w, $mark_h, 60);
if ($result_watermark === false) die("워터마크 처리에 실패하였습니다.<br />\n");
$result_save = save_image_from_resource ($src, $path_save_file);//저장
if ($result_save === false) die($GLOBALS['errormsg'] . "<br />\n");
@imagedestroy($mark);
@imagedestroy($src);
//성공하였다면 이미지 출력
?>
원본 이미지 <br />
<img src='<?=$path_file?>'> <br />
워터마크에 사용할 이미지 <br />
<img src='<?=$path_mark_file?>'> <br />
워터마크 처리한 이미지 <br />
<img src='<?=$path_save_file?>'> <br />
//이미지 처리 함수 인클루드
include_once 'lib/image_proc.function.php';
$path_file = 'sample_image/test.jpg';//원본파일
$path_mark_file ='sample_image/php.png';//워터마크에 사용할 파일
$path_save_file = 'sample_image/watermak.jpg';//워터마크 처리한 것을 저장할 파일
//원본의 이미지 리소스를 받아온다.
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");
//원본의 왼쪽 꼭지점을 기준점으로 선명도 60으로 워터마크 처리
$result_watermark = imagecopymerge($src, $mark, 0, 0, 0, 0, $mark_w, $mark_h, 60);
if ($result_watermark === false) die("워터마크 처리에 실패하였습니다.<br />\n");
$result_save = save_image_from_resource ($src, $path_save_file);//저장
if ($result_save === false) die($GLOBALS['errormsg'] . "<br />\n");
@imagedestroy($mark);
@imagedestroy($src);
//성공하였다면 이미지 출력
?>
원본 이미지 <br />
<img src='<?=$path_file?>'> <br />
워터마크에 사용할 이미지 <br />
<img src='<?=$path_mark_file?>'> <br />
워터마크 처리한 이미지 <br />
<img src='<?=$path_save_file?>'> <br />
참고 : http://kr2.php.net/manual/kr/function.ceil.php
댓글 2개
takumi22
12년 전
유창화님 강의네요 ~~
12년 전
감사합니다
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 6330 |
|
12년 전 | 1790 | |
| 6329 |
내가짱니네가짱
|
12년 전 | 1222 | |
| 6328 |
AMDbest
|
12년 전 | 486 | |
| 6327 | 12년 전 | 1688 | ||
| 6326 | 12년 전 | 1318 | ||
| 6325 | 12년 전 | 7605 | ||
| 6324 |
AMDbest
|
12년 전 | 2187 | |
| 6323 |
|
12년 전 | 1961 | |
| 6322 | 12년 전 | 2027 | ||
| 6321 | 12년 전 | 2461 | ||
| 6320 |
senseme
|
12년 전 | 558 | |
| 6319 | 12년 전 | 3698 | ||
| 6318 | 12년 전 | 1363 | ||
| 6317 |
kiplayer
|
12년 전 | 6404 | |
| 6316 | 12년 전 | 1006 | ||
| 6315 | 12년 전 | 958 | ||
| 6314 |
상엽나르도
|
12년 전 | 1277 | |
| 6313 |
검은고양이1983
|
12년 전 | 648 | |
| 6312 | 12년 전 | 3112 | ||
| 6311 | 12년 전 | 1410 | ||
| 6310 |
testers
|
12년 전 | 1475 | |
| 6309 | 12년 전 | 981 | ||
| 6308 | 12년 전 | 2598 | ||
| 6307 | 12년 전 | 1636 | ||
| 6306 | 12년 전 | 428 | ||
| 6305 | 12년 전 | 3495 | ||
| 6304 | 12년 전 | 992 | ||
| 6303 | 12년 전 | 821 | ||
| 6302 | 12년 전 | 1188 | ||
| 6301 | 12년 전 | 5560 | ||
| 6300 |
|
12년 전 | 1187 | |
| 6299 |
AMDbest
|
12년 전 | 2794 | |
| 6298 |
AMDbest
|
12년 전 | 2241 | |
| 6297 |
프리랜서개발자
|
12년 전 | 463 | |
| 6296 | 12년 전 | 2925 | ||
| 6295 |
SUPERMANs
|
12년 전 | 1370 | |
| 6294 | 12년 전 | 1287 | ||
| 6293 | 12년 전 | 1342 | ||
| 6292 |
오늘도망했다
|
12년 전 | 3262 | |
| 6291 |
senseme
|
12년 전 | 2022 | |
| 6290 |
senseme
|
12년 전 | 3682 | |
| 6289 |
senseme
|
12년 전 | 8569 | |
| 6288 |
senseme
|
12년 전 | 4164 | |
| 6287 |
senseme
|
12년 전 | 3727 | |
| 6286 |
senseme
|
12년 전 | 1349 | |
| 6285 |
senseme
|
12년 전 | 1423 | |
| 6284 |
프로프리랜서
|
12년 전 | 3142 | |
| 6283 |
프로프리랜서
|
12년 전 | 3979 | |
| 6282 |
프로프리랜서
|
12년 전 | 4383 | |
| 6281 |
프로프리랜서
|
12년 전 | 1596 | |
| 6280 | 12년 전 | 1284 | ||
| 6279 |
AMDbest
|
12년 전 | 866 | |
| 6278 | 12년 전 | 968 | ||
| 6277 |
senseme
|
12년 전 | 2710 | |
| 6276 |
senseme
|
12년 전 | 2723 | |
| 6275 |
senseme
|
12년 전 | 1242 | |
| 6274 |
|
12년 전 | 2787 | |
| 6273 | 12년 전 | 1266 | ||
| 6272 | 12년 전 | 8449 | ||
| 6271 |
senseme
|
12년 전 | 1502 | |
| 6270 |
senseme
|
12년 전 | 3760 | |
| 6269 |
senseme
|
12년 전 | 6374 | |
| 6268 |
senseme
|
12년 전 | 1552 | |
| 6267 | 12년 전 | 2822 | ||
| 6266 | 12년 전 | 573 | ||
| 6265 | 12년 전 | 1288 | ||
| 6264 | 12년 전 | 1143 | ||
| 6263 |
senseme
|
12년 전 | 1303 | |
| 6262 |
senseme
|
12년 전 | 3299 | |
| 6261 |
senseme
|
12년 전 | 1075 | |
| 6260 |
senseme
|
12년 전 | 1813 | |
| 6259 |
senseme
|
12년 전 | 1248 | |
| 6258 |
senseme
|
12년 전 | 910 | |
| 6257 | 12년 전 | 1403 | ||
| 6256 | 12년 전 | 2093 | ||
| 6255 |
senseme
|
12년 전 | 1373 | |
| 6254 |
senseme
|
12년 전 | 1258 | |
| 6253 |
senseme
|
12년 전 | 1779 | |
| 6252 |
kiplayer
|
12년 전 | 14765 | |
| 6251 | 12년 전 | 1057 | ||
| 6250 | 12년 전 | 858 | ||
| 6249 | 12년 전 | 2703 | ||
| 6248 |
senseme
|
12년 전 | 8947 | |
| 6247 | 12년 전 | 1272 | ||
| 6246 |
프로프리랜서
|
12년 전 | 1158 | |
| 6245 |
프로프리랜서
|
12년 전 | 1621 | |
| 6244 |
프로프리랜서
|
12년 전 | 1126 | |
| 6243 |
프로프리랜서
|
12년 전 | 1255 | |
| 6242 |
프로프리랜서
|
12년 전 | 3540 | |
| 6241 |
프로프리랜서
|
12년 전 | 1451 | |
| 6240 |
프로프리랜서
|
12년 전 | 2119 | |
| 6239 |
softhead
|
12년 전 | 1141 | |
| 6238 |
senseme
|
12년 전 | 1307 | |
| 6237 |
senseme
|
12년 전 | 3018 | |
| 6236 | 12년 전 | 864 | ||
| 6235 | 12년 전 | 1328 | ||
| 6234 | 12년 전 | 1598 | ||
| 6233 | 12년 전 | 2025 | ||
| 6232 | 12년 전 | 2132 | ||
| 6231 | 12년 전 | 2559 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기