如何在Laravel Intervention中设置上传图像的图像分辨率



任何人,请帮助我,我想使用图像干预将上传图像的图像分辨率设置为300dpi。

也欢迎任何替代解决方案。

我想要什么:

上传图像->将图像大小调整为(100 X 100(->将图像大小设置为小于30KB->并将图像分辨率设置为300dpi->自动下载

我已经为我的项目做了所有其他的决议。。。我在这里发送代码和链接。。。

$width = 400;
$height = 200;
$file = $request->file('upload');
$image = Image::make($file)->resize($width, $height)->encode('jpg');
$headers = [
'Content-Type' => 'image/jpeg',
'Content-Disposition' => 'attachment; filename=utipanpsa_'.$request->type.'.jpg',
];
return response()->stream(function() use ($image) {
echo $image;
}, 200, $headers);

https://www.utipanpsa.com/cropping-tools

根据文档,如果您有这样的php >= 7.2,则可以使用imageresolution()

//sets the image resolution to 200
imageresolution($imageRecource, 200);

最新更新