<?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년 전
감사합니다
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 330 |
prosper
|
20년 전 | 2286 | |
| 329 |
prosper
|
20년 전 | 1917 | |
| 328 |
prosper
|
20년 전 | 1711 | |
| 327 | 20년 전 | 3775 | ||
| 326 | 20년 전 | 4863 | ||
| 325 |
hwatta
|
20년 전 | 2492 | |
| 324 |
|
20년 전 | 3148 | |
| 323 | 20년 전 | 5872 | ||
| 322 |
hwatta
|
20년 전 | 2856 | |
| 321 |
hwatta
|
20년 전 | 2329 | |
| 320 |
yesmoa
|
20년 전 | 4580 | |
| 319 | 20년 전 | 2693 | ||
| 318 | 20년 전 | 2243 | ||
| 317 |
kyodon
|
20년 전 | 2765 | |
| 316 | 20년 전 | 2587 | ||
| 315 |
|
20년 전 | 2889 | |
| 314 |
|
20년 전 | 3347 | |
| 313 |
|
20년 전 | 2652 | |
| 312 |
yesmoa
|
20년 전 | 4727 | |
| 311 | 20년 전 | 3284 | ||
| 310 |
홀로남은자
|
20년 전 | 4574 | |
| 309 | 20년 전 | 3011 | ||
| 308 | 20년 전 | 4143 | ||
| 307 | 20년 전 | 4378 | ||
| 306 | 20년 전 | 7040 | ||
| 305 | 20년 전 | 3876 | ||
| 304 | 20년 전 | 2775 | ||
| 303 |
크리스탈처럼
|
20년 전 | 4414 | |
| 302 | 20년 전 | 2215 | ||
| 301 |
|
20년 전 | 4329 | |
| 300 | 20년 전 | 3818 | ||
| 299 | 20년 전 | 2633 | ||
| 298 | 20년 전 | 4841 | ||
| 297 |
|
20년 전 | 2534 | |
| 296 | 20년 전 | 4539 | ||
| 295 | 20년 전 | 3573 | ||
| 294 | 20년 전 | 3596 | ||
| 293 | 20년 전 | 3822 | ||
| 292 | 20년 전 | 3218 | ||
| 291 |
yesmoa
|
20년 전 | 5957 | |
| 290 | 20년 전 | 2946 | ||
| 289 | 20년 전 | 5868 | ||
| 288 |
|
20년 전 | 2384 | |
| 287 |
|
20년 전 | 1817 | |
| 286 |
|
20년 전 | 2156 | |
| 285 |
|
20년 전 | 3545 | |
| 284 |
|
20년 전 | 2042 | |
| 283 |
|
20년 전 | 4406 | |
| 282 | 20년 전 | 3384 | ||
| 281 |
|
20년 전 | 2217 | |
| 280 |
|
20년 전 | 7814 | |
| 279 | 20년 전 | 5563 | ||
| 278 | 20년 전 | 3000 | ||
| 277 |
|
20년 전 | 5576 | |
| 276 | 20년 전 | 2365 | ||
| 275 | 20년 전 | 2621 | ||
| 274 | 20년 전 | 2403 | ||
| 273 | 20년 전 | 2233 | ||
| 272 | 20년 전 | 2161 | ||
| 271 | 20년 전 | 2622 | ||
| 270 | 20년 전 | 2674 | ||
| 269 | 20년 전 | 2506 | ||
| 268 | 20년 전 | 2697 | ||
| 267 | 20년 전 | 2382 | ||
| 266 | 20년 전 | 2575 | ||
| 265 | 20년 전 | 3516 | ||
| 264 |
|
20년 전 | 5377 | |
| 263 |
|
20년 전 | 3741 | |
| 262 | 20년 전 | 3201 | ||
| 261 |
허저비
|
20년 전 | 5947 | |
| 260 |
|
20년 전 | 5724 | |
| 259 | 20년 전 | 4148 | ||
| 258 | 20년 전 | 2382 | ||
| 257 | 20년 전 | 3203 | ||
| 256 | 20년 전 | 1917 | ||
| 255 | 20년 전 | 1587 | ||
| 254 | 20년 전 | 3158 | ||
| 253 | 20년 전 | 3551 | ||
| 252 | 20년 전 | 5132 | ||
| 251 | 20년 전 | 5826 | ||
| 250 | 20년 전 | 3686 | ||
| 249 | 20년 전 | 5031 | ||
| 248 | 20년 전 | 3300 | ||
| 247 | 20년 전 | 3657 | ||
| 246 |
|
20년 전 | 7966 | |
| 245 |
|
20년 전 | 5926 | |
| 244 | 20년 전 | 4498 | ||
| 243 |
|
20년 전 | 4075 | |
| 242 | 20년 전 | 2802 | ||
| 241 | 20년 전 | 2753 | ||
| 240 | 20년 전 | 2390 | ||
| 239 | 20년 전 | 1676 | ||
| 238 |
아우겐나이스
|
20년 전 | 2284 | |
| 237 |
email
|
20년 전 | 3696 | |
| 236 | 20년 전 | 4180 | ||
| 235 | 20년 전 | 10474 | ||
| 234 | 20년 전 | 5083 | ||
| 233 | 20년 전 | 3386 | ||
| 232 | 20년 전 | 3228 | ||
| 231 | 20년 전 | 3868 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기