s

이미지에 워터마크 처리하기

<?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 />



참고 : http://kr2.php.net/manual/kr/function.ceil.php
|

댓글 2개

유창화님 강의네요 ~~
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

+
제목 글쓴이 날짜 조회
12년 전 조회 1,991
12년 전 조회 3,522
12년 전 조회 2,010
12년 전 조회 9,299
12년 전 조회 2,261
12년 전 조회 4,477
12년 전 조회 7,137
12년 전 조회 2,293
12년 전 조회 3,563
12년 전 조회 1,296
12년 전 조회 1,995
12년 전 조회 1,873
12년 전 조회 2,052
12년 전 조회 4,035
12년 전 조회 1,809
12년 전 조회 2,559
12년 전 조회 1,998
12년 전 조회 1,635
12년 전 조회 2,056
12년 전 조회 2,804
12년 전 조회 2,097
12년 전 조회 1,933
12년 전 조회 2,448
12년 전 조회 1.5만
12년 전 조회 1,714
12년 전 조회 1,488
12년 전 조회 3,345
12년 전 조회 9,572
12년 전 조회 1,889
12년 전 조회 1,842
12년 전 조회 2,282
12년 전 조회 1,758
12년 전 조회 1,942
12년 전 조회 4,216
12년 전 조회 2,110
12년 전 조회 2,780
12년 전 조회 1,777
12년 전 조회 1,952
12년 전 조회 3,656
12년 전 조회 1,497
12년 전 조회 1,976
12년 전 조회 2,298
12년 전 조회 2,731
12년 전 조회 2,843
12년 전 조회 3,280
12년 전 조회 1,736
12년 전 조회 1,788
12년 전 조회 5,157
12년 전 조회 2,210
12년 전 조회 2,387
12년 전 조회 6,224
12년 전 조회 3,920
12년 전 조회 2,884
12년 전 조회 2,034
12년 전 조회 4,198
12년 전 조회 3,222
12년 전 조회 2,886
12년 전 조회 2,566
12년 전 조회 2,259
12년 전 조회 2,269
12년 전 조회 2,012
12년 전 조회 3,091
12년 전 조회 2,407
12년 전 조회 2,105
12년 전 조회 3,175
12년 전 조회 2,366
12년 전 조회 2,941
12년 전 조회 4,164
12년 전 조회 1,923
12년 전 조회 2,900
12년 전 조회 1,761
12년 전 조회 2,247
12년 전 조회 2,882
12년 전 조회 2,487
12년 전 조회 5,292
12년 전 조회 3,406
12년 전 조회 3,607
12년 전 조회 1,966
12년 전 조회 9,290
12년 전 조회 4,106
12년 전 조회 2,164
12년 전 조회 2,023
12년 전 조회 3,461
12년 전 조회 6,139
12년 전 조회 4,155
12년 전 조회 2,073
12년 전 조회 1.4만
12년 전 조회 1,949
12년 전 조회 1,373
12년 전 조회 4,765
12년 전 조회 2,252
12년 전 조회 1만
12년 전 조회 1,546
12년 전 조회 2,023
12년 전 조회 3,991
12년 전 조회 1,629
12년 전 조회 2,530
12년 전 조회 4,521
12년 전 조회 1,821
12년 전 조회 1,712