******************************************************************************/ $font_size_auto = true; //$font_size_auto = true; ÀÏ°æ¿ì¶óµµ $font_size='';°¡ °ø¶õÀÏ°æ¿ì¸¸ Àû¿ë $font_size =''; // $font_size = 10;°ú°°ÀÌ ¼ýÀÚ ÀÖÀ»°æ¿ì¿¡´Â $font_size_auto = true; ´Â ¹«½ÃµÊ $color = '#ffffff'; //ÅؽºÆ®·Î°í »ö±ò $drop_shadow = true; //ÅؽºÆ®·Î°í¿¡ ±×¸²ÀÚ È¿°ú $shadow_color = '#606060'; //$drop_shadow = true; ÀÏ°æ¿ì¸¸ Àû¿ë $angle=0; //¾ç¼öÁõ°¡´Â À§ÂÊ ¼¼·Î±Û¾¾,À½¼öÀÏ°æ¿ì ¾Æ·¡ÂÊ ¼¼·Î±Û¾¾ $quality=150; //Ãâ·ÂµÈ À̹ÌÁöÀÇ ÇØ»óµµ ³·À»¼ö·Ï ¼±¸íÄ¡ ¸øÇÔ $font = 'arial.ttf'; //ÆùÆ® ¼±Åà $transparency =30; //Áõ°¡ÇÒ¼ö·Ï ºÒÅõ¸íÇØÁü $logo_location = 'top_l'; //top_l,top_r,center,bottom_l,bottom_r $offset_x=50; //$logo_location±âÁØÀ¸·Î ¾ç¼ö´Â Á·ΠÀ̵¿,À½¼ö´Â ¿ì·Î À̵¿ $offset_y=200; //$logo_location±âÁØÀ¸·Î ¾ç¼ö´Â À§·Î À̵¿,À½¼ö´Â ¾Æ·¡·Î À̵¿ $SourceImage = $_GET['photo']; $WaterMarkText = 'www.flash24.co.kr'; //-------------------------------------------------------------------------------------- $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]); $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 == '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); imagettftext($image_ct, $font_size,$angle,$x,$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); ?>