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

时间:2021-09-13 07:33:43
$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?

这是php中的水印代码,当我们将文本添加到曲线图像像马克杯图像时工作正常,字母不重叠曲线图像我们怎样才能克服?

1 个解决方案

#1


1  

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?

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

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

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

#1


1  

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?

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

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

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