douchi1945 2016-04-21 13:28
浏览 68

将imagettftext函数转换为函数

So I'm trying to use the GD Library into my Wordpress website.

I've created the images.php page with this code :

function loadImage($name, $lastname) {

    header ("Content-type: image/jpg");

$fond = imagecreatefromjpeg('link');

$font = "arial.ttf";
$noir  = imagecolorallocate($fond, 0, 0, 0);
$blanc = imagecolorallocate($fond, 255, 255, 255);


imagettftext($fond, 20, 0, 600, 80, $blanc, $font, $name);
imagestring($fond, 5, 200, 200, $lastname, $blanc);
imagejpeg($fond, 'folder');
}

Then I execute loadImage("bob"); into another page. The imagestring function works, but not the imagettftexte. I tried everything but it seems that imagettftext doesnt work when giving args for the string to display.

If you guys could help me on that...

Thanks

  • 写回答

2条回答 默认 最新

  • dongtie0929 2016-04-21 14:10
    关注

    I think you have done all but just need to change color something like:

    $fond = imagecreatefromjpeg('link_of_image');
    
    $font = "arial.ttf";
    $noir  = imagecolorallocate($fond, 0, 0, 0);
    $blanc = imagecolorallocate($fond, 0, 0, 0);
    
    imagettftext($fond, 20, 0, 600, 80, $blanc, $font, $name);
    
    imagestring($fond, 5, 200, 200, $lastname, $blanc);
    
    header ("Content-type: image/jpg");
    imagejpeg($fond);
    imagedestroy($fond);
    

    Due to white color it not display.

    评论

报告相同问题?

悬赏问题

  • ¥15 processing提取音乐节奏
  • ¥15 python进程启动打包问题
  • ¥15 gg加速器加速游戏时,提示不是x86架构
  • ¥15 python按要求编写程序
  • ¥15 Python输入字符串转化为列表排序具体见图,严格按照输入
  • ¥20 XP系统在重新启动后进不去桌面,一直黑屏。
  • ¥15 opencv图像处理,需要四个处理结果图
  • ¥15 无线移动边缘计算系统中的系统模型
  • ¥15 深度学习中的画图问题
  • ¥15 java报错:使用mybatis plus查询一个只返回一条数据的sql,却报错返回了1000多条