I want to add a watermark to my uploaded image using intervention image library in laravel.I have installed it through command composer require intervention/image
, added Intervention\Image\ImageServiceProvider::class
in providers array and 'Image' => Intervention\Image\Facades\Image::class
in aliases array.
This is my code sample:
if($request->file1)
{
$this->validate($request, [
'file1' => 'required|image|mimes:jpeg,png,jpg,gif,svg',
]);
$imageName = time().'-'.rand(11111, 99999).'.'.$request->file1->getClientOriginalExtension();
$imageName = $imageName->insert('https://www.exabytes.my/wp-content/uploads/400x150-exabytes-logo.png','center');
$request->file1->move('theme/img/properties', $imageName);
}