2

I try to use intervention, library to manipulate image.

I succeeded to create one, use watermake with "insert" function but I write text without knowing size. How to do that ? I would like to enhance text readability by adding a box behind.

<?php

require 'vendor/autoload.php';

use Intervention\Image\ImageManagerStatic as Image;

// configure with favored image driver (gd by default)
Image::configure([]);

// and you are ready to go ...
$image = Image::make('background.jpeg');
$height = $image->height();
$width = $image->width();

$logo1 = Image::make('team1.png')->widen(200);
$logo1_height = $logo1->height();

$image->insert($logo1, 'top-left', 110, ceil($height / 2.7 - $logo1_height / 2));

$image->text('Team 1', $width / 2, $height - 85, function($font) {
    $font->file(realpath('fonts/TheAbsolute.ttf'));
    $font->color('#EEE');
    $font->size(100);
    $font->align('center');
    $font->valign('middle');
});

echo $image->response();

$image->destroy();
z0om
  • 133
  • 1
  • 10

0 Answers0