Файл: editor/addtext.php
Строк: 25
<?
include ("../config.inc.php");
$rwhadtstsss = getimagesize($fn_add_text);
if ($rwhadtstsss[2]==2)
{
$srcaddtxt=imagecreatefromjpeg($fn_add_text);
}
elseif ($rwhadtstsss[2]==3)
{
$srcaddtxt=imagecreatefrompng($fn_add_text);
}
$w_src_addtxt=imagesx($srcaddtxt);
$h_src_addtxt=imagesy($srcaddtxt);
if ($rwhadtstsss[2]==2)
{
header("Content-type: image/jpeg");
}
elseif ($rwhadtstsss[2]==3)
{
header("Content-type: image/png");
}
$font_color_a = trim($rgb_color);
$red_color = hexdec(substr($font_color_a, -2));
$green_color = hexdec(substr($font_color_a, -4, 2));
$blue_color = hexdec(substr($font_color_a, -6, 2));
$color=imagecolorallocate($srcaddtxt, $red_color, $green_color, $blue_color);
$add_text_ttf_box=imagettfbbox($size,0,$font_facettf,$label);
foreach ($add_text_ttf_box as $awdwd)
{
$text_ttf_box[]=$awdwd;
}
if ($udrl_foto=="ul")
{
$x_text=6-$text_ttf_box[0];
$y_text=3-$text_ttf_box[7];
}
elseif ($udrl_foto=="dl")
{
$x_text=6-$text_ttf_box[0];
$y_text= $h_src_addtxt-$text_ttf_box[1]-3;
}
elseif ($udrl_foto=="ur")
{
$x_text = $w_src_addtxt-$text_ttf_box[2]-6;
$y_text=3-$text_ttf_box[5];
}
elseif ($udrl_foto=="dr")
{
$x_text = $w_src_addtxt-$text_ttf_box[2]-6;
$y_text= $h_src_addtxt-$text_ttf_box[1]-3;
}
imagettftext($srcaddtxt,$size,0,$x_text,$y_text, $color, $font_facettf, $label);
if ($rwhadtstsss[2]==2)
{
imagejpeg($srcaddtxt);
imagejpeg($srcaddtxt, "$fn_add_text");
}
elseif ($rwhadtstsss[2]==3)
{
imagepng($srcaddtxt);
imagepng($srcaddtxt, "$fn_add_text");
}
imagedestroy($srcaddtxt);
?>