Laravel with Packages | Add Watermark on Images in Laravel

Install intervention/image Package

We need to install the intervention/image composer package for adding a watermark to the image, so you can install using the following command:

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

Add Watermark to image

Here, i will create simple route and add watermark to image. so you need to add two images on your public “images” folder for testing.

Route::get('addWatermark', function(){$img = Image::make(public_path('images/main.png'));/* insert watermark at bottom-right corner with 10px offset */$img->insert(public_path('images/logo.png'), 'bottom-right', 10, 10);$img->save(public_path('images/main-new.png'));dd('saved image successfully.');});



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