laravel-ffmpeg icon indicating copy to clipboard operation
laravel-ffmpeg copied to clipboard

Adding watermark to images.

Open thetrollishere12 opened this issue 2 years ago • 1 comments

Hi I was wondering how do I add a watermark to an frame from videos with filters added to it & just an image with filters? Thank you, love using what you guys have created!

// Watermark To Frame From Video FFMpeg::fromDisk(env('STORAGE_DISK')) ->open('temporary/temporary-upload/'.$request->setting["media-id"]) ->getFrameFromSeconds($request->setting['singleImageFrame']) ->export() ->addFilter(function (FrameFilters $fil) use ($filters){ $fil->custom($filters['eq']); $fil->custom($filters['colorlevels']); $fil->watermark(storage_path()."/app/public/image_asset/logo.png", [ 'position' => 'relative', 'bottom' => 50, 'right' => 50, ]); }) ->toDisk(env('STORAGE_DISK')) ->save();

// Watermark To Image

FFMpeg::fromDisk(env('STORAGE_DISK')) ->open('temporary/temp_final/temporary-media/'.$b_id["id"].'/output.'.$request->setting["format"]) ->addWatermark(function(WatermarkFilter $watermark) { $watermark->fromDisk('public') ->open('image_asset/logo.png') ->right(25) ->bottom(25) ->width(100) ->height(100); }) ->toDisk(env('STORAGE_DISK')) ->save();

thetrollishere12 avatar Jun 08 '22 08:06 thetrollishere12

saw your issue and seconds late i saw this in the changelog:

If you're using the Watermark manipulation feature, make sure you upgrade spatie/image to v2.

May this your answer?

ibrainventures avatar Jun 13 '22 14:06 ibrainventures