$WaterMarkText = 'a';는 가능하나 $WaterMarkText = '$B';는 출력이 안됩니다. 채택완료
클럽보드로 카피할 경우
글자를 직접 넣으경우 ('A') Ctrl+c,Ctrl+v 하면 나오지만 값을 받아오면 ($b) 아무것도 안나오내요..
/******************************************************************************
Program: watermark-text.php
Copyright (c) 2008 sonosini All rights reserved.
Do not remove this notice
- 사용법 -
******************************************************************************/
include_once("./_common.php"); set_session('ss_wr_id', $_REQUEST['wr_id']);
$font_size_auto = true; $font_size ='40'; $color = '#ffffff'; $drop_shadow = true; $shadow_color = '#606060'; $angle=40; $quality=190; $font = 'malgunbd.ttf'; $transparency =90; $logo_location = 'center'; $offset_x=-420; $offset_x1=-820; $offset_x2=-1220; $offset_y=10; $SourceImage = $_GET['photo']; $id = $member[mb_id]; $WaterMarkText = $id;
//--------------------------------------------------------------------------------------
$img_name=explode('/',$SourceImage); $img_name_right = sizeof($img_name) - 1; $img_name=explode('.',$img_name[$img_name_right]); //$WaterMarkedImage =$img_name[0].'_marked.'.$img_name[1];//$this_skin.'/watermark_temp/'.$img_name[0].'_marked.'.$img_name[1];
list($width, $height) = getimagesize($SourceImage); $image_ct = imagecreatetruecolor($width, $height); if($img_name[1] == "gif") $image = imagecreatefromgif($SourceImage); if($img_name[1] == "jpg" or $img_name[1] == "jpeg") $image = imagecreatefromjpeg($SourceImage); if($img_name[1] == "png") $image = imagecreatefrompng($SourceImage); if (!$image) die();
imagecopyresampled($image_ct, $image, 0, 0, 0, 0, $width, $height, $width, $height); $color = sscanf($color, '#%2x%2x%2x'); $color_r = $color[0]; $color_g = $color[1]; $color_b = $color[2]; if ($font_size_auto) { if ($font_size == ''){ if ($width <= '150px') $font_size = 0; elseif ($width <= '250px') $font_size = 9; elseif ($width <= '450px') $font_size = 10; elseif ($width <= '550px') $font_size = 11; elseif ($width <= '650px') $font_size = 12; elseif ($width <= '750px') $font_size = 14; elseif ($width <= '850px') $font_size = 15; elseif ($width <= '980px') $font_size = 16; else $font_size = 17; } }
$WaterMarkText= iconv("EUC-KR","UTF-8" ,$WaterMarkText); $ttfsize = imagettfbbox($font_size, $angle, $font, $WaterMarkText); $ttfx = $offset_x + max($ttfsize[0],$ttfsize[2],$ttfsize[4],$ttfsize[6]); $ttfx1 = $offset_x1 + max($ttfsize[0],$ttfsize[2],$ttfsize[4],$ttfsize[6]); $ttfx2 = $offset_x2 + max($ttfsize[0],$ttfsize[2],$ttfsize[4],$ttfsize[6]); $ttfy = $offset_y + max($ttfsize[1],$ttfsize[3],$ttfsize[5],$ttfsize[7]);
if ($logo_location == 'top_l') {$x=4; $y=$ttfy + 11; $s_x=5; $s_y=$ttfy + 12;} if ($logo_location == 'top_r') {$x=$width - $ttfx - 4; $y=$ttfy + 11; $s_x=$width - $ttfx - 5; $s_y=$ttfy + 12;} if ($logo_location == 'center') {$x=($width - $ttfx - 2)/2; $y=($height - $ttfy - 2)/2; $s_x=($width - $ttfx - 3)/2; $s_y=($height - $ttfy - 3)/2;} if ($logo_location == 'center') {$x1=($width - $ttfx1 - 2)/2; $y=($height - $ttfy - 2)/2; $s_x1=($width - $ttfx1 - 3)/2; $s_y=($height - $ttfy - 3)/2;} if ($logo_location == 'center') {$x2=($width - $ttfx2 - 2)/2; $y=($height - $ttfy - 2)/2; $s_x2=($width - $ttfx2 - 3)/2; $s_y=($height - $ttfy - 3)/2;} if ($logo_location == 'bottom_l') {$x= 2; $y=$height - $ttfy - 2; $s_x= 3; $s_y=$height - $ttfy - 3;} if ($logo_location == 'bottom_r') {$x=$width - $ttfx - 2; $y=$height - $ttfy - 2; $s_x=$width - $ttfx -3; $s_y=$height - $ttfy - 3;}
if ($drop_shadow) { $scolor = sscanf($shadow_color, '#%2x%2x%2x'); $scolor_r = $scolor[0]; $scolor_g = $scolor[1]; $scolor_b = $scolor[2]; $color = imagecolorallocatealpha($image_ct, $scolor_r, $scolor_g, $scolor_b, $transparency); }
for($i=$font_size+280; $i<=$height-$font_size-50; $i+=$font_size+160) { $text_pos_y = $i; imagettftext($image_ct, $font_size,$angle,$x,$text_pos_y, $color, $font, $WaterMarkText); imagettftext($image_ct, $font_size,$angle,$x1,$text_pos_y, $color, $font, $WaterMarkText); imagettftext($image_ct, $font_size,$angle,$x2,$text_pos_y, $color, $font, $WaterMarkText); } $color = imagecolorallocatealpha($image_ct, $color_r, $color_g, $color_b, $transparency); imagettftext($image_ct, $font_size,$angle,$s_x,$s_y, $color, $font, $WaterMarkText);
if($img_name[1] == "gif") header("Content-Type: image/gif"); if($img_name[1] == "jpg" or $img_name[1] == "jpeg") header("Content-Type: image/jpeg"); if($img_name[1] == "png") header("Content-Type: image/png"); imagejpeg ($image_ct, null, $quality);
imagedestroy($image); imagedestroy($image_ct);
?> 여기에서
$WaterMarkText = $id;
부분인대 [mb_id] 값이 그냥 모니터상에는 보이는대 ctrl+c,ctrl+v하며 아무것도 안보입니다.
원인을 모르겠습니다..미치겠내요
답변 1개
상단 사용법 보면 소스 이미지도 get으로 받고 있잔아요 ᆞ
파라메타를 붙인다음 get으로 바다아가세요
photo=1.jpg&mb=$member[~
받는쪽 $_GET['mb']
그리고 이건 파일 인쿠르트가 아니기 땜시 변수 써봫자 암것도 안오느거 맞습니다 쿼리를 쏴서 디비로 추출 해주던지 변수를 읽어내는곳에서 파라메터로 받아가든지 해야되요
맛폰이라 글 쓰기 디게 힘드네요
ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ
Ps)근데 이렇게 하면 방문자가 워터마크를 맘대로 바쿠겟네요ᆞ위같게하면 안됄듯
글아이디를 파라메터로 넘긴후
워터마크 상단에서 그걸 받은다음 쿼리를 날려서 작성자를 디비에서 추출 혀야겧네요ᆞ
쿼리소스는 그누에 다 잇으니 응 용해보세요
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인