<?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년 전
감사합니다
게시판 목록
팁게시판
디자인과 관련된 유용한 정보를 공유하세요.
질문은 상단의 QA에서 해주시기 바랍니다.
질문은 상단의 QA에서 해주시기 바랍니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 5302 | 12년 전 | 1607 | ||
| 5301 |
냐옹이사범
|
12년 전 | 2317 | |
| 5300 | 12년 전 | 6520 | ||
| 5299 | 12년 전 | 5208 | ||
| 5298 | 12년 전 | 3015 | ||
| 5297 |
프로프리랜서
|
12년 전 | 2535 | |
| 5296 |
프로프리랜서
|
12년 전 | 1896 | |
| 5295 |
프로프리랜서
|
12년 전 | 2359 | |
| 5294 |
프로프리랜서
|
12년 전 | 1859 | |
| 5293 |
프로프리랜서
|
12년 전 | 1638 | |
| 5292 |
프로프리랜서
|
12년 전 | 5535 | |
| 5291 |
프로프리랜서
|
12년 전 | 2603 | |
| 5290 |
프로프리랜서
|
12년 전 | 3065 | |
| 5289 |
프로프리랜서
|
12년 전 | 1739 | |
| 5288 |
프로프리랜서
|
12년 전 | 1456 | |
| 5287 | 12년 전 | 2755 | ||
| 5286 |
오늘도망했다
|
12년 전 | 2345 | |
| 5285 |
오늘도망했다
|
12년 전 | 1686 | |
| 5284 |
오늘도망했다
|
12년 전 | 6647 | |
| 5283 |
오늘도망했다
|
12년 전 | 2520 | |
| 5282 | 12년 전 | 3654 | ||
| 5281 |
jinmuk
|
12년 전 | 1459 | |
| 5280 |
jinmuk
|
12년 전 | 4229 | |
| 5279 |
jinmuk
|
12년 전 | 5554 | |
| 5278 |
jinmuk
|
12년 전 | 2261 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기