Php 如何在Laravel干预中设置上传图像的图像分辨率

Php 如何在Laravel干预中设置上传图像的图像分辨率,php,laravel,image,intervention,Php,Laravel,Image,Intervention,任何人,请帮助我,我想使用图像干预将上传图像的图像分辨率设置为300dpi 也欢迎任何替代解决方案 我想要的是: 上载图像->将图像大小调整为(100 X 100)->将图像大小设置为小于30KB->并将图像分辨率设置为300dpi->自动下载 我已经做了所有其他的事情来解决我的项目。。。我在这里发送代码和链接 $width = 400; $height = 200; $file = $request->file('upload'); $image = Image::make($file

任何人,请帮助我,我想使用图像干预将上传图像的图像分辨率设置为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);

根据,如果您的
php>=7.2
如下所示,您可以使用
imageresolution()

//sets the image resolution to 200
imageresolution($imageRecource, 200);
根据,如果您的
php>=7.2
如下所示,则可以使用
imageresolution()

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

您面临的问题是什么?我无法设置生成图像的分辨率,您面临的问题是什么?我无法设置生成图像的分辨率,这会导致错误:imageresolution()希望参数1为resource,对象给定必须将图像资源作为第一个参数发送错误:imageresolution()要求参数1为资源,对象给定必须将图像资源作为第一个参数发送