How to add text to a curved image?

$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 the watermark code in php, it works great when we add text to a crooked image, like a mug image, the letter does not overlap the curved image, how can we overcome?

+4
source share
1 answer

You have added this to your code:

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

So, I think that it will not overlap the corners if the text is not longer / longer than the image itself, so that it will reach the corners. Perhaps change the wm_padding so that it is wider or wider than the radius of the curve / border?

And, as Alix Axel said, please post the appropriate code for more detailed / useful answers.

+1
source

Source: https://habr.com/ru/post/1310076/


All Articles