Use the intervention / image package, it easily integrates with the Laravel framework by following the step-by-step installation and then integration >.
Step by step
$ php composer.phar require intervention/image
After installing the package in your Laravel, go to config/app.php
and add in the array of providers
plus this line:
Intervention\Image\ImageServiceProvider::class
and to facilitate type in array of $aliases
'Image' => Intervention\Image\Facades\Image::class
and to finish the installation and operation of the package type in the command line
$ php artisan vendor:publish --provider="Intervention\Image\ImageServiceProviderLaravel5"
Working with this package:
Route::get('/', function()
{
$img = Image::make('foo.jpg')->resize(300, 200);
return $img->response('jpg');
});
In your specific case, when burning the disk image, press again and call the insert method with the folder parameters and name the file with the .png
extension to create the mascara in your image and have it saved again.
Example:
// open an image file
$img = Image::make('public/foo.jpg');
// now you are able to resize the instance
$img->resize(320, 240);
// and insert a watermark for example
$img->insert('public/watermark.png');
// finally we save the image as a new file
$img->save('public/bar.jpg');
Source: Intervention Image
You can also use it directly when sending the photo:
Image::make($request->file('img')->getPathname());