laravel-ffmpeg
laravel-ffmpeg copied to clipboard
Adding watermark to images.
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();
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?