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 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 正弦信号发生器串并联电路电阻无法保持同步怎么办
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 个人网站被恶意大量访问,怎么办
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)