如何向弯曲图像添加文本?

发布于 2024-09-02 06:08:27 字数 537 浏览 2 评论 0原文

$config['source_image'] = '/path/to/image/mypic.jpg';
$config['wm_text'] = 'Copyright 2006 - John Doe';
$config['wm_type'] = 'text';
$config['wm_font_path'] = './system/fonts/texb.ttf';
$config['wm_font_size'] = '16';
$config['wm_font_color'] = 'ffffff';
$config['wm_vrt_alignment'] = 'bottom';
$config['wm_hor_alignment'] = 'center';
$config['wm_padding'] = '20';

$this->image_lib->initialize($config);

$this->image_lib->watermark();

这是php中的水印代码,当我们向马克杯等曲线图像添加文本时,它工作正常 图像中,字母不重叠,弯曲图像如何克服?

$config['source_image'] = '/path/to/image/mypic.jpg';
$config['wm_text'] = 'Copyright 2006 - John Doe';
$config['wm_type'] = 'text';
$config['wm_font_path'] = './system/fonts/texb.ttf';
$config['wm_font_size'] = '16';
$config['wm_font_color'] = 'ffffff';
$config['wm_vrt_alignment'] = 'bottom';
$config['wm_hor_alignment'] = 'center';
$config['wm_padding'] = '20';

$this->image_lib->initialize($config);

$this->image_lib->watermark();

This is water mark code in php, it is working fine when we add text to curve image like mug
image, the letter is not overlap the curved image how can we overcome?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无人接听 2024-09-09 06:08:27

您将其添加到代码中:

$config['wm_vrt_alignment'] = 'bottom';
$config['wm_hor_alignment'] = 'center';

所以我想它不会与角重叠,除非文本与图像本身一样长/宽,以便它到达角。也许更改填充wm_padding,使其与曲线/边框半径一样宽或更宽?

正如 Alix Axel 所说,请发布一些相关代码以获得更详细/可用的答案。

You added this to your code:

$config['wm_vrt_alignment'] = 'bottom';
$config['wm_hor_alignment'] = 'center';

So I guess it won't overlap the corners, unless the text is as long/wide as the image itself, so that it reaches the corners. Maybe change the padding wm_padding so that it's as wide or wider than the curve/border radius?

And like Alix Axel said, please post some relevant code for more detailed/usable answers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文