The final output should be like image(HELLO WORLD):
这就是我正在做的:-
$im = imagecreate(400,400);
$txtcol = imagecolorallocate($im, 0xFF, 0x00, 0x00);
$size = 20;
$txt = 'DUMMY TEXT';
$font = './font/Capriola-Regular.ttf';
/*two points for base line*/
$x1 = 50; $x2 = 300;
$y1 = 150; $y2 = 170;
/*bof finding line angle*/
$delta_x = $x2-$x1;
$delta_y = $y2-$y1;
$texangle = (rad2deg(atan2($delta_y,$delta_x)) * 180 / M_PI)-360;
/*eof finding the line angle*/
imageline($im,$x1,$y1,$x2,$y2,$txtcol); //Drawing line
imagettftext($im, $size, $texangle, $x1, $y1, $txtcol, $font, $txt); // Drawing text over line at line's angle
当前输出如下:
有人能告诉我我的代码有什么问题吗?
THanks
好吧,一直在玩。尝试更换:
$texangle = (rad2deg(atan2($delta_y,$delta_x)) * 180 / M_PI)-360;
With:
$texangle = (atan2($delta_y,$delta_x) * -180 / M_PI)-360;
输出你的值:
输出其他值:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)