我想裁剪图像并调整图像大小并保存到多个文件夹中。但只有一张图像保存在文件夹中(第一个)
public function update(Request $request)
{
$image = $request->file('file');
$name = time().''.mt_rand(100, 200).'_1280x768.'.$image->getClientOriginalExtension();
$name1 = time().''.mt_rand(100, 200).'_320x240.'.$image->getClientOriginalExtension();
$image1= $image->move('public/storage/uploadimage/main', $name);
$image2= $image->move('public/storage/uploadimage/thumb', $name1);
$img = Image::make($imagename);
$img->fit(1280, 768, function ($constraint) {
$constraint->upsize();
});
$img->insert('https://kafesta.com/public/images/kafesta-10.png', 'center');
$img->save($imagename);
$img1 = Image::make($imagename1);
$img1->fit(320, 240, function ($constraint) {
$constraint->upsize();
});
$img1->insert('https://kafesta.com/public/images/kafesta-10.png', 'center');
$img1->save($imagename1);
}
$image1 = clone $image;
$image2 = clone $image;