用gd制作混合图像
making mix image with gd
我正在尝试使用 php 和 gd 库制作表格。
表单包含带有透明 packgroung 的 png 徽标。
现在我有 3 个问题:
当我制作边框时,我想将徽标放在
图像,它不再是透明背景
我使用波斯字体并使用 imagettftext 函数。它显示
字符,但在波斯语中我们合并了单词,但它显示
字符分隔
- 如何绘制圆角边框
这是我的代码:
$fontSize=4;
$width = imagefontwidth($font) * strlen($string)+10 ;
$height = imagefontheight($font) ;
$handle = ImageCreate (800, 400) or die ("Cannot Create image");
$logo = imagecreatefrompng( 'Logo.png' );
$bg_color = ImageColorAllocate ($handle, 255, 240, 250);
$txt_color = ImageColorAllocate ($handle, 0, 0, 0);
$title="فرم قرارداد";
$font = "IRANSans.ttf";
$title_size = 18;
imagettftext( $handle, $title_size, 0, 620, 100, $txt_color, $font, $title );
$black = imagecolorallocate($handle, 0, 0, 0);
imagerectangle($handle, 20, 20, 780, 380, $black);
imagecopy($handle, $logo, 10, 10, 0, 0, 161, 160);
header('Content-Type: image/png');
imagepng($handle);
- 看到这个答案:php GD create a transparent png image
- 如果您想使用您的语言的排版特征,则必须使用 OpenType (.otf) 字体。
- 你可能想看看 GD 的 imagearc。
我正在尝试使用 php 和 gd 库制作表格。 表单包含带有透明 packgroung 的 png 徽标。 现在我有 3 个问题:
当我制作边框时,我想将徽标放在 图像,它不再是透明背景
我使用波斯字体并使用 imagettftext 函数。它显示 字符,但在波斯语中我们合并了单词,但它显示 字符分隔
- 如何绘制圆角边框
这是我的代码:
$fontSize=4;
$width = imagefontwidth($font) * strlen($string)+10 ;
$height = imagefontheight($font) ;
$handle = ImageCreate (800, 400) or die ("Cannot Create image");
$logo = imagecreatefrompng( 'Logo.png' );
$bg_color = ImageColorAllocate ($handle, 255, 240, 250);
$txt_color = ImageColorAllocate ($handle, 0, 0, 0);
$title="فرم قرارداد";
$font = "IRANSans.ttf";
$title_size = 18;
imagettftext( $handle, $title_size, 0, 620, 100, $txt_color, $font, $title );
$black = imagecolorallocate($handle, 0, 0, 0);
imagerectangle($handle, 20, 20, 780, 380, $black);
imagecopy($handle, $logo, 10, 10, 0, 0, 161, 160);
header('Content-Type: image/png');
imagepng($handle);
- 看到这个答案:php GD create a transparent png image
- 如果您想使用您的语言的排版特征,则必须使用 OpenType (.otf) 字体。
- 你可能想看看 GD 的 imagearc。