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.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥15 统计大规模图中的完全子图问题
  • ¥15 使用LM2596制作降压电路,一个能运行,一个不能
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗
  • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路
  • ¥15 phython读取excel表格报错 ^7个 SyntaxError: invalid syntax 语句报错
  • ¥20 @microsoft/fetch-event-source 流式响应问题
  • ¥15 ogg dd trandata 报错
  • ¥15 高缺失率数据如何选择填充方式