PRAMIT PAUL
PRAMIT PAUL

Reputation: 114

How to set Image Resolution in uploaded Image in Laravel Intervention

Please, anyone, help me I want to set the Image Resolution to 300dpi for the uploaded image using Image Intervention.

Any alternate solution is also welcome.

What I want:

Upload Image -> Resize image to (100 X 100) -> Set image size to less than 30KB -> and set image resolution to 300dpi -> auto download

I have done everything else the resolution to my project... Here I'm sending the code and link ...

$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

Upvotes: 1

Views: 1434

Answers (1)

Babak Asadzadeh
Babak Asadzadeh

Reputation: 1239

acording to document you can use imageresolution() if you have php >= 7.2 like this:

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

Upvotes: 1

Related Questions