Laravel Media-插入水印快速管理面板

问题描述

我正在为项目使用“快速管理”面板,现在我需要在每张图像上插入水印。 这是我在控制器中的store function

if ($request->input('thumbnail',false)) {
   $automobil->addMedia(storage_path('tmp/uploads/' . $request->input('thumbnail')))->toMediaCollection('thumbnail');
}

foreach ($request->input('fotografije',[]) as $file) {
   $automobil->addMedia(storage_path('tmp/uploads/' . $file))->toMediaCollection('fotografije');
}

如何在此代码中插入水印?我尝试过:

$file->insert(public_path('images/watermark/watermark.png'),'bottom-right',10,10);

但是它不起作用。请帮忙。

解决方法

嗨@Milos 你可以使用这个额外的包: Intervention image 并使用它添加水印。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...