워터마크 소스 적용후 gif 미지원 정보
워터마크 소스 적용후 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);
?>
------------------------------------------------------------------------------------------------------------------------------------
위 주소의 워터마크 소스를 적용시켰는데 이미지가 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);
?>
------------------------------------------------------------------------------------------------------------------------------------
댓글 전체
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
요기에서 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
아이고 죄송합니다;;
서코필드님 답변을 미처 확인하지 못했네요 ^^;
말씀하신 소스로 적용하니 문제없이 잘 나옵니다 :)
서코필드님 답변을 미처 확인하지 못했네요 ^^;
말씀하신 소스로 적용하니 문제없이 잘 나옵니다 :)