How to add watermark on an image in Laravel 5.8 Step by Step

In this blog post, we will learn, how to add watermark to an image in Laravel 5.8 application, to add watermark to images we will use intervention image composer package in Laravel 5.8. we can add image or text as a watermark on the image in Laravel. For more doc, you can follow

Step:1 Install intervention/image Package

At the first step, I install an intervention/image composer package for adding watermark to the image in Laravel 5.8. to install a package using the following command.

composer require intervention/image
‘providers’ => [
Intervention\Image\ImageServiceProvider::class
]
‘aliases’ => [
‘Image’ => Intervention\Image\Facades\Image::class
]

Step:2 Add Watermark to image

Here, I created a controller(you can use a simple route) to add watermark to the image. so you need to add two images on your public “images” folder for testing purpose.

public function addWatermark(){
$img = Image::make(public_path('images/main.png'));
$img->insert(public_path('watermark.png'),'bottom-right',10, 10);
$img->save();
}

Software Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store