<?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년 전
감사합니다
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 6530 |
퍼블리셔강
|
12년 전 | 653 | |
| 6529 | 12년 전 | 1307 | ||
| 6528 | 12년 전 | 626 | ||
| 6527 | 12년 전 | 791 | ||
| 6526 | 12년 전 | 6580 | ||
| 6525 | 12년 전 | 549 | ||
| 6524 | 12년 전 | 841 | ||
| 6523 | 12년 전 | 494 | ||
| 6522 | 12년 전 | 540 | ||
| 6521 | 12년 전 | 801 | ||
| 6520 | 12년 전 | 742 | ||
| 6519 | 12년 전 | 1744 | ||
| 6518 |
가슴시린하늘
|
12년 전 | 1726 | |
| 6517 | 12년 전 | 1364 | ||
| 6516 | 12년 전 | 5226 | ||
| 6515 | 12년 전 | 1497 | ||
| 6514 | 12년 전 | 1599 | ||
| 6513 | 12년 전 | 955 | ||
| 6512 | 12년 전 | 1985 | ||
| 6511 | 12년 전 | 1374 | ||
| 6510 | 12년 전 | 3077 | ||
| 6509 |
프로프리랜서
|
12년 전 | 2550 | |
| 6508 |
프로프리랜서
|
12년 전 | 1900 | |
| 6507 |
프로프리랜서
|
12년 전 | 2375 | |
| 6506 |
프로프리랜서
|
12년 전 | 1858 | |
| 6505 |
프로프리랜서
|
12년 전 | 1634 | |
| 6504 | 12년 전 | 1044 | ||
| 6503 | 12년 전 | 1129 | ||
| 6502 |
프로프리랜서
|
12년 전 | 5556 | |
| 6501 |
프로프리랜서
|
12년 전 | 2606 | |
| 6500 |
프로프리랜서
|
12년 전 | 3087 | |
| 6499 |
프로프리랜서
|
12년 전 | 1750 | |
| 6498 |
프로프리랜서
|
12년 전 | 1463 | |
| 6497 | 12년 전 | 815 | ||
| 6496 |
yunkiri486
|
12년 전 | 1814 | |
| 6495 | 12년 전 | 919 | ||
| 6494 | 12년 전 | 1491 | ||
| 6493 | 12년 전 | 2763 | ||
| 6492 |
오늘도망했다
|
12년 전 | 2338 | |
| 6491 |
오늘도망했다
|
12년 전 | 1678 | |
| 6490 |
오늘도망했다
|
12년 전 | 6659 | |
| 6489 |
오늘도망했다
|
12년 전 | 2497 | |
| 6488 |
홈피119
|
12년 전 | 701 | |
| 6487 | 12년 전 | 683 | ||
| 6486 | 12년 전 | 1408 | ||
| 6485 | 12년 전 | 2054 | ||
| 6484 | 12년 전 | 901 | ||
| 6483 | 12년 전 | 722 | ||
| 6482 | 12년 전 | 1342 | ||
| 6481 | 12년 전 | 1472 | ||
| 6480 |
Header
|
12년 전 | 691 | |
| 6479 |
|
12년 전 | 1129 | |
| 6478 |
개초보제이
|
12년 전 | 1395 | |
| 6477 | 12년 전 | 803 | ||
| 6476 | 12년 전 | 1076 | ||
| 6475 | 12년 전 | 3684 | ||
| 6474 | 12년 전 | 1429 | ||
| 6473 | 12년 전 | 963 | ||
| 6472 | 12년 전 | 858 | ||
| 6471 |
AMDbest
|
12년 전 | 1205 | |
| 6470 |
jinmuk
|
12년 전 | 1448 | |
| 6469 |
jinmuk
|
12년 전 | 4251 | |
| 6468 |
jinmuk
|
12년 전 | 5581 | |
| 6467 | 12년 전 | 705 | ||
| 6466 |
jinmuk
|
12년 전 | 2278 | |
| 6465 |
jinmuk
|
12년 전 | 6737 | |
| 6464 |
jinmuk
|
12년 전 | 2409 | |
| 6463 |
jinmuk
|
12년 전 | 9336 | |
| 6462 |
희망과열정
|
12년 전 | 540 | |
| 6461 |
Header
|
12년 전 | 725 | |
| 6460 |
희망과열정
|
12년 전 | 1362 | |
| 6459 |
프리랜서개발자
|
12년 전 | 1679 | |
| 6458 | 12년 전 | 1342 | ||
| 6457 |
jinmuk
|
12년 전 | 1951 | |
| 6456 |
jinmuk
|
12년 전 | 2351 | |
| 6455 |
jinmuk
|
12년 전 | 3211 | |
| 6454 |
jinmuk
|
12년 전 | 2177 | |
| 6453 |
jinmuk
|
12년 전 | 2362 | |
| 6452 |
jinmuk
|
12년 전 | 2317 | |
| 6451 |
jinmuk
|
12년 전 | 1612 | |
| 6450 |
jinmuk
|
12년 전 | 1402 | |
| 6449 |
jinmuk
|
12년 전 | 1048 | |
| 6448 |
jinmuk
|
12년 전 | 1251 | |
| 6447 |
jinmuk
|
12년 전 | 2012 | |
| 6446 |
jinmuk
|
12년 전 | 1574 | |
| 6445 |
jinmuk
|
12년 전 | 1266 | |
| 6444 |
jinmuk
|
12년 전 | 2312 | |
| 6443 |
jinmuk
|
12년 전 | 2048 | |
| 6442 |
jinmuk
|
12년 전 | 1890 | |
| 6441 |
jinmuk
|
12년 전 | 1621 | |
| 6440 |
jinmuk
|
12년 전 | 2320 | |
| 6439 |
jinmuk
|
12년 전 | 1136 | |
| 6438 |
wndProc
|
12년 전 | 784 | |
| 6437 | 12년 전 | 408 | ||
| 6436 |
senseme
|
12년 전 | 553 | |
| 6435 | 12년 전 | 1047 | ||
| 6434 | 12년 전 | 2481 | ||
| 6433 | 12년 전 | 2488 | ||
| 6432 | 12년 전 | 1566 | ||
| 6431 |
밥먹고합시다
|
12년 전 | 1193 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기