In this tutorial, you will learn adding watermark to images laravel. let’s discuss about laravel intervention image watermark. i explained simply step by step laravel image watermark example. you'll learn image watermark in laravel 7.
I will give you very simple example to add watermark to image in laravel 7 project. many times we need to add watermark to our website images, so we can identify this all images by our website.
in this example, we will install intervention/image package and then we will create one simple route to adding image watermark in laravel app. so let's follow bellow step to add image watermark in laravel 5.
Install intervention/image Package
We need to install intervention/image composer package for adding watermark to image, so you can install using following command:
composer require intervention/image
After that you need to set providers and alias.
'providers' => [
'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.
make sure you have main.png and logo.png image on your images folder for demo.So let's see bellow example.
$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);
dd('saved image successfully.');
I hope it van help you...
Do you like below Tutorials ?
- How to Open URL in New Tab using Jquery?
- Laravel 7.x and 6.x Routing Tutorial
- Ng Bootstrap Modal in Angular 8 Example
- Bootstrap 4 Datepicker in Angular 9/8 Example
- Disable Registration Route in Laravel
- Bootstrap Timepicker in Angular Example
- Count Number of Pages in PDF - PHP Script
- Digital Signature PHP Script Example