image intervention add text to image code example

Example: intervention image can't add text

$font = new \Intervention\Image\Gd\Font(urldecode($data['text_value']));
$font->valign('top');
$font->color('#'.$data['text_color']);
$font->file('./../app/fonts/'.$data['text_font'].'.ttf');
$font->size($data['text_size']);
$size = $font->getBoxSize();

$gdmanager = new ImageManager(array('driver' => 'gd'));

$image_text = $gdmanager->canvas( $size['width'], $size['height']);

$font->applyToImage($image_text);

$text_watermark = $manager->make($image_text->encode('data-url'));
$image->insert( $text_watermark->response('png'), getPositionName($data['text_position']), $data['text_padding'], $data['text_padding'] ); //this is the main image created earlier using make

Tags:

Misc Example