Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I add text to curved image?

Tags:

php

image

gd

$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?

like image 465
user343700 Avatar asked Nov 15 '22 10:11

user343700


1 Answers

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.

like image 64
Alec Avatar answered Dec 10 '22 15:12

Alec