M

워터마크 소스 적용후 gif 미지원

http://sir.co.kr/bbs/board.php?bo_table=g4_tiptech&wr_id=16170&sca=&sfl=wr_subject%7C%7Cwr_content&stx=%BF%F6%C5%CD%B8%B6%C5%A9&sop=and

위 주소의 워터마크 소스를 적용시켰는데 이미지가 jpg인 경우엔 잘 나오는데 gif일 경우엔 엑박이 뜨네요..

다른 커뮤니티에서 여쭤봤는데 그냥 다른설명 없이

$path_info = pathinfo($source_photo);

if ($path_info['extension'] == 'gif' ) {
//gif process
} else {
//jpeg process
}

라고만 답변을 달아주셔서 답변 달아주신분께는 죄송하지만

php 문외한인 저는 가져다가 어떻게 요리해야할지 모르겠습니다;



---------------------------------------------------------makeimg.php---------------------------------------------------------

<?
/*
program: makeimg.php
description: creates new image by merging source image
with watermark and outputs it to the browser
*/

header("Content-Type: image/jpeg");
//(because the script outputs picture)

if (isset($_GET['transparency'])) {
if ($_GET['transparency'] >= 0 && $_GET['transparency'] <= 100) {
$transparency = (int) $_GET['transparency'];
}
}
else $transparency = 100; // 워터마크 투명도 조절

//$transparency = (int) $_GET['transparency'];

//source photo
$source_photo = stripslashes($_GET['photo']);
$photo = imagecreatefromjpeg($source_photo);

//watermark
$watermark = imagecreatefrompng('img/watermark.png');
$watermark_width = imagesx($watermark);
$watermark_height = imagesy($watermark);

//location of the watermark on the source image
$size = getimagesize($source_photo);
$dest_x = ($size[0] - $watermark_width) / 2;
$dest_y = ($size[1] - $watermark_height) / 2;

//make the image (merge source image with watermark)
imagecopymerge($photo, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, $transparency);

//output the image
imagejpeg($photo);

//free memory
imagedestroy($photo);
imagedestroy($watermark);
?>
------------------------------------------------------------------------------------------------------------------------------------
|

댓글 2개

http://pupu.kr/pupu/bbs/board.php?bo_table=01_5&wr_id=8
요기에서 watermark.rar 받으세요.

Miletos님 이전 질문에도 답변이 달려 있습니다.
확인 안하셨나 보네요.^^
http://sir.co.kr/bbs/board.php?bo_table=g4_qa&wr_id=99759&sca=&sfl=wr_subject%7C%7Cwr_content&stx=%BF%F6%C5%CD&spt=0&page=0
아이고 죄송합니다;;

서코필드님 답변을 미처 확인하지 못했네요 ^^;

말씀하신 소스로 적용하니 문제없이 잘 나옵니다 :)
댓글을 작성하시려면 로그인이 필요합니다. 로그인

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.

+
제목 글쓴이 날짜 조회
17년 전 조회 1,524
17년 전 조회 820
17년 전 조회 952
17년 전 조회 862
17년 전 조회 1,513
17년 전 조회 990
17년 전 조회 837
17년 전 조회 716
17년 전 조회 777
17년 전 조회 916
17년 전 조회 745
17년 전 조회 757
17년 전 조회 812
17년 전 조회 764
17년 전 조회 974
17년 전 조회 961
17년 전 조회 645
17년 전 조회 781
17년 전 조회 712
17년 전 조회 693
🐛 버그신고