dsfew215211 2018-11-20 13:22
浏览 36
已采纳

用gd制作混合图像

im trying to make a form with php and gd library. form contains a png logo with transparent packgroung. now i have 3 problems:

  1. when i make a border then i want to place the logo in top corner of image, its not transparented background anymore

  2. im using persian font and using imagettftext function. it show the characters but in persian we have merged words but it show characters seperated

  3. how can i draw rounded corner borders

here is my code:

$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);
  • 写回答

1条回答 默认 最新

  • dqnk57224 2018-11-20 13:33
    关注
    1. See this answer: php GD create a transparent png image
    2. You'll have to use an OpenType (.otf) font, if you want to make use of your language's typographic characteristics.
    3. You might want to take a look at GD's imagearc.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何构建全国统一的物流管理平台?
  • ¥100 ijkplayer使用AndroidStudio/CMake编译,如何支持 rtsp 直播流?
  • ¥20 和学习数据的传参方式,选择正确的传参方式有关
  • ¥15 这是网络安全里面的poem code
  • ¥15 用js遍历数据并对非空元素添加css样式
  • ¥15 使用autodl云训练,希望有直接运行的代码(关键词-数据集)
  • ¥50 python写segy数据出错
  • ¥20 关于线性结构的问题:希望能从头到尾完整地帮我改一下,困扰我很久了
  • ¥30 3D多模态医疗数据集-视觉问答
  • ¥20 设计一个二极管稳压值检测电路